`

Web Service

阅读更多
WSDL Java
Message  input1...n                    
Opteraton Method
Message output Return value
Fault Message Exception
Service Service Class
PortType PortType Class

 

 

Binding - define message format and protocol details

 

Port - define interface exposed by webservice.

 

Operation type - 4 types: one-way, request-response, solicit response, notification

 

From To
<Message> name <PortType> =>Operation => Input/Output message attribute
<Message> name <Binding> => Input/Output => header/body message attribute
<PortyType> =>Operation => input name <Binding> =>Operation => input name
<PortType> => name <Binding> => type attribute

 

 

PortType can contain more than 1 operation

 

Binding defines port communication protocol,can define multi-binding for a certain port type

Biding is targeting operation of a port type, it defines

  • message format(soap, text)
  • transport type (http, email...)

 

There are 2 kinds of error message:

  1. Soap Fault message - system generated due to system error
  2. Business error message - defined as fault message, and returned in soap message body

 

 

WSDL Binding Style

  • RPC/encoded,
  • RPC/literal
  • Document/encoded,
  • Doument/literal
  • document/literal wrapped pattern

The style has nothing to do with a programming model. It merely dictates how to translate a WSDL binding to a SOAP message. Nothing more.

http://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/

 

 

Web service style

RPC, Document which are not how web service is called, but how the message is constructed (formated)

 

Compare two styles

 

RPC <foo:concat>
xmlns:foo="http://ttdev.com/ss"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-Instance">
<s1 xsi:type="xsd:string">abc</s1>
<s2 xsi:type="xsd:string">123</s2>
</foo:concat>
Document <foo:concatRequest xmlns:foo="http://ttdev.com/ss">
<s1>abc</s1>
<s2>123</s2>
</foo:concatRequest>

 

The significant difference is that the former can't be
validated with a schema while the latter can. Therefore, document style web
service is becoming the dominant style. According to an organization called
"WS-I (web services interoperability organization)", you should use document
style web services only.

(Developing  web service with Apache CXF and Axis 2, Kent Ka La Tong ) good book, highly recommneded, first 2 chapters are free, I read it and find its quite helpful and easy to understand,

You can find the free chapters here: http://wiki.apache.org/ws/FrontPage/Axis2/


URI

  • URL - location of an obect.
  • URN - purely Id of an object

 

Qname

namespace + local part

In Web service, each port, binding, port type and operation has a Qname uniquely identify it,

 

 

Web Service style

  • RPC-Literal is always wrapped (not BARE). - allow more than one element bound to body
  • Document Literal (BARE) - allow only one element bound to body
  • Document Literal Wrapped (The parameterStyle attribute in the SOAPBinding annotation is removed and that implies the service is wrapped due to "Wrapped" being the default for the attribute.)
  • http://www.khanna111.com/articles/SOAP_Styles_Differences.html
  • http://www.coderanch.com/t/501314/Web-Services/java/Simple-Unwrapped-Wrapped-SOAP-messages#2277662
  • http://fusesource.com/docs/framework/2.2/jaxws/JAXWSServiceDevJavaFirstAnnotateOptionalSOAPBinding.html
  • http://msdn.microsoft.com/en-us/library/2b4bx2t6%28VS.80%29.aspx

 

Client side handler

  • For an outbound message (for instance, a client request under the request/response MEP), the handleMessage method or handleFault method in a LogicalHandler code execute before their counterparts in a SOAPHandler .

  • For an inbound message, the handleMessage method or handleFault method in a SOAPHandler code execute before their counterparts in a LogicalHandler .

 

Way to deal with web service attachement

 

  1. The DIME solution - it seems an old protocol .
  2. The MTOM solution - protocol on the way
  3. Binary encoding - xsd:hexBinary or a xsd:base64Binary type, simplest but not efficient, as paraser will go through it even don't need it.

 

http://www.ibm.com/developerworks/webservices/library/ws-tip-noattach.html

 

 

wsimport

wsdl - physicla location of wsdl file when run the command

wsdlLocation - its set in the @WebserviceClient to point to wsdl file which can be found in Jar file

 

JAXB

If compiler see ref or inner complexType , it will generate elementType

 

Sample 1:

<jaxws:bindings
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    wsdlLocation="xxxx/xxxxx/xxxxxxxx.wsdl"
    xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
        <jaxws:package name="xx.xx.xxxx.xxx"/>
</jaxws:bindings>

 

Sample 2:

<?xml version="1.0" encoding="UTF-8"?>
<jaxb:bindings jaxb:version="2.0"
               xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
               xmlns:xsd="http://www.w3.org/2001/XMLSchema"
               schemaLocation = "xx/xxx/xxxx.xsd"
               node="//xsd:schema">
        <jaxb:schemaBindings>
            <jaxb:package name="package.xxx.xxx"/>
        </jaxb:schemaBindings>   
    </jaxb:bindings>

 

Explain Axis2 - how to handle web service request

http://wso2.org/library/176

 

Web Service class annotation

@javax.jws.WebService(endpointInterface = "xxx.xxx.XXXPortType", targetNamespace = "http://ns.xxxx.xxx.xxxx/xxx/xxx", serviceName = "XXXService", portName = "XXXXPort")
@Addressing(enabled = false)
@HandlerChain(file = "xxxhandlers.xml")

MyServiceImpl implement MyServicePortyType{...}

 

IBM Admin Console URL

http://localhost:9061/ibm/console/unsecureLogon.jsp

https://localhost:9043/ibm/console/logon.jsp

 

 

WSDL 1.1 distinguishes between two message styles: document and RPC. Here's how each style affects the contents of <soap:Body> .

  • Document: <soap:Body> contains one or more child elements called parts. There are no SOAP formatting rules for what the <soap:Body> contains; it contains whatever the sender and the receiver agree upon.
  • RPC: RPC implies that <soap:Body> contains an element with the name of the method or remote procedure being invoked. This element in turn contains an element for each parameter of that procedure.

For applications that use serialization/deserialization to abstract away the data wire format, there's one more choice to be made: the serialization format. There are two popular serialization formats today:

  • SOAP Encoding: SOAP encoding is a set of serialization rules defined in section 5 of SOAP 1.1 and is sometimes referred to as "section 5 encoding." The rules specify how objects, structures, arrays, and object graphs should be serialized. Generally speaking, an application using SOAP encoding is focused on remote procedure calls and will likely use RPC message style. The rest of this article ignores SOAP encoding and focuses on literal format.
  • Literal: Data is serialized according to a schema. In practice, this schema is usually expressed using W3C XML Schema. Although there are no prescribed rules for serializing objects, structures, and graphs, etc., the service's schema describes the application-level Infoset of each of the service's messages.

Ref : http://msdn.microsoft.com/en-us/library/ms996466.aspx

 

 

分享到:
评论

相关推荐

    C#Web Service C#Web Service C#Web Service

    C# Web Service是一种基于.NET Framework的开发技术,用于创建分布式应用程序,使得不同系统间能够通过互联网进行通信。这种服务提供了一种标准化的方式,允许应用程序通过HTTP协议交换数据,因此,即使它们是由不同...

    《实战Delphi6/Kylix2/SOAP/Web Service程序设计篇》(

    在《实战Delphi6/Kylix2/SOAP/Web Service程序设计篇》这本书中,作者李维精心编撰了一套系统而全面的教程,针对的是Delphi6和Kylix2这两个经典的Visual Basic derivative (VBD) 编程环境,尤其是针对SOAP(Simple ...

    asp.net写的web service例子

    ASP.NET Web Service是一种基于.NET Framework的简单方法,用于构建可跨平台、跨语言通信的Web应用程序。这个例子是为初学者设计的,旨在演示如何创建和使用Web Service,以及如何在ASP.NET环境中调用这些服务。 ...

    T100 Web Service 接口开发v1.5版.rar

    《T100 Web Service 接口开发v1.5版》 在现代信息技术领域,Web Service接口开发扮演着至关重要的角色,它使得不同系统之间的数据交换和功能调用变得简单而高效。本文将深入探讨T100 Web Service接口开发的最新版本...

    D6 SOAP_WEB SERVICE

    标题"D6 SOAP_WEB SERVICE"指的是使用Delphi编程语言开发基于SOAP(简单对象访问协议)的Web服务。在本文中,我们将深入探讨这个主题,了解如何使用Delphi构建Web服务以及SOAP在其中的作用。 首先,让我们了解一下...

    service now web service

    ### Service Now Web Service知识点 #### 一、简介与概述 **Service Now Web Service**是一种集成解决方案,它允许不同应用程序之间通过网络进行通信。Service Now 支持多种类型的 Web 服务,包括作为提供者...

    web service第一次启动慢

    web service在第一次启动时出现启动缓慢的问题,通常是指在运行或访问web service时遇到的启动延迟现象。这种问题可能会在不同的web service应用中出现,尤其是在首次连接或部署新服务时更为常见。web service是一种...

    Java完整的Web Service示例代码,学会做web service程序

    本示例代码将帮助你理解和实现一个完整的Web Service程序。 首先,我们来看"xfire-client"部分。XFire是早先的一个Java Web Service框架,它简化了客户端和服务端的开发。在Java中,创建Web Service客户端通常涉及...

    Web service应用实例

    ### Web Service应用实例详解 #### 一、IIS安装与配置 在开发Web Service之前,首先需要确保服务器上已正确安装并配置了Internet Information Services (IIS)。无论是Windows Server 2003还是Windows XP,IIS都是...

    实战Delphi6.Kylix2.SOAP.Web Service程序设计篇李维著.zip

    《实战Delphi6.Kylix2.SOAP.Web Service程序设计篇》是由知名技术专家李维编著的一本专业书籍,主要面向的是希望深入理解和应用Delphi6、Kylix2、SOAP以及Web Service技术的开发者。这本书详细介绍了如何利用这些...

    Web Service Proxy Wizard的介绍,安装,以及如何使用

    Web Service Proxy Wizard 是一个工具,它为Visual Studio 6.0的开发者提供了一种方法,可以将Web服务封装成一个代理组件(.dll),这个组件可以在设计时通过早期绑定(Early Binding)像其他COM组件一样使用。...

    Web Service编程:用C#开发网络服务

    Web Service编程是现代软件开发中的一个重要领域,尤其是在分布式系统和跨平台通信中。C#作为.NET框架的主要编程语言,提供了强大的工具和库来创建和消费Web Service。本篇将深入探讨C#环境下开发Web Service的相关...

    PB11开发Web Service应用

    本篇内容将深入探讨如何利用PB11来开发Web Service应用,这对于初学者来说是一份宝贵的资源。 一、Web Service基础 Web Service是一种基于开放标准的、平台无关的通信协议,它允许不同系统之间的数据交换。在PB11中...

    vmware vSphere web service SDK开发指南

    VMware vSphere Web Service SDK开发指南是一份指导开发者如何使用VMware vSphere SDK进行开发的文档。VMware vSphere是VMware公司推出的业界领先虚拟化解决方案,它通过提供高级抽象层来管理和控制计算资源,为用户...

    yahoo web service-2.11.zip

    **Yahoo Web Service 2.11** Yahoo Web Service 2.11 是一个重要的API接口,它允许开发者利用Yahoo的在线资源和服务进行程序开发。这个版本可能是对之前版本的升级,可能包含了性能优化、新功能的添加以及已知问题...

    T100 Web Service开发,调试整合重启检查说明(简体版)

    ### T100 Web Service 开发、调试及整合重启检查说明 #### 文件概述 本文件主要针对T100 Web Service的开发、调试以及在遇到问题时如何进行整合重启检查进行了详细说明。适用于T100项目的工程师和服务人员,帮助...

    实战Delphi6.Kylix2.SOAP.Web Service程序设计篇李维著

    《实战Delphi6.Kylix2.SOAP.Web Service程序设计篇》是由知名技术专家李维撰写的一本专业书籍,主要涵盖了使用Delphi6和Kylix2进行SOAP(简单对象访问协议)以及Web Service开发的核心技术和实践应用。这本书是...

Global site tag (gtag.js) - Google Analytics