Friday, 16 December 2011

Wrapper/Bare/RPC example

RPC Java:

@WebMethod(operationName = "hello")
public String sayHello(
@WebParam(name = "firstname") String nachname,
@WebParam(name = "lastname") String vorname)

RPC WSDL:

<message name="hello">
  <part name="firstname" type="xsd:string" />
  <part name="lastname" type="xsd:string" />
</message>

<message name="helloResponse">
  <part name="return" type="xsd:string" />
</message>

<portType name="testService">
  <operation name="hello">
    <input message="tns:hello" />
    <output message="tns:helloResponse" />
  </operation>
</portType>

Document/Wrapped Java (like RPC, plus generated "jaxws" wrapper classes):

@WebMethod(operationName = "hello")
public String sayHello(
@WebParam(name = "firstname") String nachname,
@WebParam(name = "lastname") String vorname)

Document/Wrapped WSDL:

<types>
  <xs:element name="hello" nillable="true" type="tns:sayHello"/>
  <xs:element name="helloResponse" nillable="true" type="tns:sayHelloResponse"/>

  <xs:complexType name="sayHello">
    <xs:sequence>
      <xs:element name="firstname" type="xs:string" minOccurs="0"/>
      <xs:element name="lastname" type="xs:string" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="sayHelloResponse">
    <xs:sequence>
      <xs:element name="return" type="xs:string" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>
</types>

<message name="hello">
  <part name="parameters" element="tns:hello"/>
</message>

<message name="helloResponse">
  <part name="parameters" element="tns:helloResponse"/>
</message>

<portType name="testService">
  <operation name="hello">
    <input message="tns:hello"/>
    <output message="tns:helloResponse"/>
  </operation>
</portType>

Document/Bare Java (no generated class, with additional "Person" bean):

@WebMethod(operationName = "hello")
public String sayHello(Person p)

Document/Bare WSDL:

<types>
  <xs:element name="hello" nillable="true" type="tns:person"/>
  <xs:element name="helloResponse" nillable="true" type="xs:string"/>

  <xs:complexType name="person">
    <xs:sequence>
      <xs:element name="nachname" type="xs:string" minOccurs="0"/>
      <xs:element name="vorname" type="xs:string" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>
</types>

<message name="hello">
  <part name="hello" element="tns:hello"/>
</message>

<message name="helloResponse">
  <part name="helloResponse" element="tns:helloResponse"/>
</message>

<portType name="testService">
  <operation name="hello">
    <input message="tns:hello"/>
    <output message="tns:helloResponse"/>
  </operation>
</portType>