10 Replies Latest reply on Feb 14, 2006 1:27 PM by Thomas Diesler

    Unable to get document/literal sample2 working from StepBySt

    Ron Douthit Newbie

      I'm trying to get a .NET client to interface with a JBOSS deployed web service using Jboss 4.0.3SP1. I started with the examples from the Wiki using document/literal. I've tried the steps manually and have recently simply deployed the code and WSDL (with the addition of elementFormDefault="qualified") and other artifacts directly from the jbossws-samples-4[1].0.3. Everything deploys OK and I can generate stubs on the client without error. When I send the request, however, I get an invalid element error from JBOSS:

      Invalid element in org.jboss.test.webservice.samples2.OrderProcess_processOrder_RequestStruct - Person_2



      The SOAP request from the .NET client is:

      <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <soap:Body>
       <processOrder xmlns="http://org.jboss.test.webservice/samples2/types">
       <arrayOfOrderItem_1>
       <name>Book</name>
       <quantity>3</quantity>
       </arrayOfOrderItem_1>
       <arrayOfOrderItem_1>
       <name>Glasses</name>
       <quantity>2</quantity>
       </arrayOfOrderItem_1>
       <Person_2>
       <age>32</age>
       <name>Ron</name>
       </Person_2>
       </processOrder>
       </soap:Body>
      </soap:Envelope>


      The WSDL (which came from the samples zip file, except for my elementFormDefault="qualified" addition) is:



      <?xml version="1.0" encoding="UTF-8"?>
      
      <definitions name="OrderProcessService" targetNamespace="http://org.jboss.test.webservice/samples2" xmlns:tns="http://org.jboss.test.webservice/samples2" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:ns2="http://org.jboss.test.webservice/samples2/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
       <types>
       <schema elementFormDefault="qualified" targetNamespace="http://org.jboss.test.webservice/samples2/types" xmlns:tns="http://org.jboss.test.webservice/samples2/types" xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://www.w3.org/2001/XMLSchema">
       <complexType name="processOrder">
       <sequence>
       <element name="arrayOfOrderItem_1" type="tns:OrderItem" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
       <element name="Person_2" type="tns:Person" nillable="true"/>
       </sequence>
       </complexType>
       <complexType name="OrderItem">
       <sequence>
       <element name="name" type="string" nillable="true"/>
       <element name="quantity" type="int"/>
       </sequence>
       </complexType>
       <complexType name="Person">
       <sequence>
       <element name="age" type="int"/>
       <element name="name" type="string" nillable="true"/>
       </sequence>
       </complexType>
       <complexType name="processOrderResponse">
       <sequence>
       <element name="result" type="tns:OrderResponse" nillable="true"/>
       </sequence>
       </complexType>
       <complexType name="OrderResponse">
       <sequence>
       <element name="items" type="tns:OrderItem" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
       <element name="message" type="string" nillable="true"/>
       </sequence>
       </complexType>
       <complexType name="OrderException">
       <sequence>
       <element name="message" type="string" nillable="true"/>
       </sequence>
       </complexType>
       <element name="processOrder" type="tns:processOrder"/>
       <element name="processOrderResponse" type="tns:processOrderResponse"/>
       <element name="OrderException" type="tns:OrderException"/>
       </schema>
       </types>
       <message name="OrderProcess_processOrder">
       <part name="parameters" element="ns2:processOrder"/>
       </message>
       <message name="OrderProcess_processOrderResponse">
       <part name="result" element="ns2:processOrderResponse"/>
       </message>
       <message name="OrderException">
       <part name="OrderException" element="ns2:OrderException"/>
       </message>
       <portType name="OrderProcess">
       <operation name="processOrder">
       <input message="tns:OrderProcess_processOrder"/>
       <output message="tns:OrderProcess_processOrderResponse"/>
       <fault name="OrderException" message="tns:OrderException"/>
       </operation>
       </portType>
       <binding name="OrderProcessBinding" type="tns:OrderProcess">
       <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
       <operation name="processOrder">
       <soap:operation soapAction=""/>
       <input>
       <soap:body use="literal"/>
       </input>
       <output>
       <soap:body use="literal"/>
       </output>
       <fault name="OrderException">
       <soap:fault name="OrderException" use="literal"/>
       </fault>
       </operation>
       </binding>
       <service name="OrderProcessService">
       <port name="OrderProcessPort" binding="tns:OrderProcessBinding">
       <soap:address location="REPLACE_WITH_ACTUAL_URL"/>
       </port>
       </service>
      </definitions>
      


      The jaxrpc-mapping.xml (once again from the samples zip):
      <?xml version="1.0" encoding="UTF-8"?>
      <java-wsdl-mapping version="1.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd">
       <package-mapping>
       <package-type>org.jboss.test.webservice.samples2</package-type>
       <namespaceURI>http://org.jboss.test.webservice/samples2/types</namespaceURI>
       </package-mapping>
       <package-mapping>
       <package-type>org.jboss.test.webservice.samples2</package-type>
       <namespaceURI>http://org.jboss.test.webservice/samples2</namespaceURI>
       </package-mapping>
       <java-xml-type-mapping>
       <java-type>org.jboss.test.webservice.samples2.OrderException</java-type>
       <root-type-qname xmlns:typeNS="http://org.jboss.test.webservice/samples2/types">typeNS:OrderException</root-type-qname>
       <qname-scope>complexType</qname-scope>
       <variable-mapping>
       <java-variable-name>message</java-variable-name>
       <xml-element-name>message</xml-element-name>
       </variable-mapping>
       </java-xml-type-mapping>
       <java-xml-type-mapping>
       <java-type>org.jboss.test.webservice.samples2.OrderResponse</java-type>
       <root-type-qname xmlns:typeNS="http://org.jboss.test.webservice/samples2/types">typeNS:OrderResponse</root-type-qname>
       <qname-scope>complexType</qname-scope>
       <variable-mapping>
       <java-variable-name>items</java-variable-name>
       <xml-element-name>items</xml-element-name>
       </variable-mapping>
       <variable-mapping>
       <java-variable-name>message</java-variable-name>
       <xml-element-name>message</xml-element-name>
       </variable-mapping>
       </java-xml-type-mapping>
       <java-xml-type-mapping>
       <java-type>org.jboss.test.webservice.samples2.Person</java-type>
       <root-type-qname xmlns:typeNS="http://org.jboss.test.webservice/samples2/types">typeNS:Person</root-type-qname>
       <qname-scope>complexType</qname-scope>
       <variable-mapping>
       <java-variable-name>age</java-variable-name>
       <xml-element-name>age</xml-element-name>
       </variable-mapping>
       <variable-mapping>
       <java-variable-name>name</java-variable-name>
       <xml-element-name>name</xml-element-name>
       </variable-mapping>
       </java-xml-type-mapping>
       <java-xml-type-mapping>
       <java-type>org.jboss.test.webservice.samples2.OrderProcess_processOrder_RequestStruct</java-type>
       <root-type-qname xmlns:typeNS="http://org.jboss.test.webservice/samples2/types">typeNS:processOrder</root-type-qname>
       <qname-scope>complexType</qname-scope>
       <variable-mapping>
       <java-variable-name>arrayOfOrderItem_1</java-variable-name>
       <xml-element-name>arrayOfOrderItem_1</xml-element-name>
       </variable-mapping>
       <variable-mapping>
       <java-variable-name>Person_2</java-variable-name>
       <xml-element-name>Person_2</xml-element-name>
       </variable-mapping>
       </java-xml-type-mapping>
       <java-xml-type-mapping>
       <java-type>org.jboss.test.webservice.samples2.OrderItem</java-type>
       <root-type-qname xmlns:typeNS="http://org.jboss.test.webservice/samples2/types">typeNS:OrderItem</root-type-qname>
       <qname-scope>complexType</qname-scope>
       <variable-mapping>
       <java-variable-name>name</java-variable-name>
       <xml-element-name>name</xml-element-name>
       </variable-mapping>
       <variable-mapping>
       <java-variable-name>quantity</java-variable-name>
       <xml-element-name>quantity</xml-element-name>
       </variable-mapping>
       </java-xml-type-mapping>
       <java-xml-type-mapping>
       <java-type>org.jboss.test.webservice.samples2.OrderProcess_processOrder_ResponseStruct</java-type>
       <root-type-qname xmlns:typeNS="http://org.jboss.test.webservice/samples2/types">typeNS:processOrderResponse</root-type-qname>
       <qname-scope>complexType</qname-scope>
       <variable-mapping>
       <java-variable-name>result</java-variable-name>
       <xml-element-name>result</xml-element-name>
       </variable-mapping>
       </java-xml-type-mapping>
       <exception-mapping>
       <exception-type>org.jboss.test.webservice.samples2.OrderException</exception-type>
       <wsdl-message xmlns:exMsgNS="http://org.jboss.test.webservice/samples2">exMsgNS:OrderException</wsdl-message>
       <constructor-parameter-order>
       <element-name>message</element-name>
       </constructor-parameter-order>
       </exception-mapping>
       <service-interface-mapping>
       <service-interface>org.jboss.test.webservice.samples2.OrderProcessService</service-interface>
       <wsdl-service-name xmlns:serviceNS="http://org.jboss.test.webservice/samples2">serviceNS:OrderProcessService</wsdl-service-name>
       <port-mapping>
       <port-name>OrderProcessPort</port-name>
       <java-port-name>OrderProcessPort</java-port-name>
       </port-mapping>
       </service-interface-mapping>
       <service-endpoint-interface-mapping>
       <service-endpoint-interface>org.jboss.test.webservice.samples2.OrderProcess</service-endpoint-interface>
       <wsdl-port-type xmlns:portTypeNS="http://org.jboss.test.webservice/samples2">portTypeNS:OrderProcess</wsdl-port-type>
       <wsdl-binding xmlns:bindingNS="http://org.jboss.test.webservice/samples2">bindingNS:OrderProcessBinding</wsdl-binding>
       <service-endpoint-method-mapping>
       <java-method-name>processOrder</java-method-name>
       <wsdl-operation>processOrder</wsdl-operation>
       <wrapped-element/>
       <method-param-parts-mapping>
       <param-position>0</param-position>
       <param-type>org.jboss.test.webservice.samples2.OrderItem[]</param-type>
       <wsdl-message-mapping>
       <wsdl-message xmlns:wsdlMsgNS="http://org.jboss.test.webservice/samples2">wsdlMsgNS:OrderProcess_processOrder</wsdl-message>
       <wsdl-message-part-name>arrayOfOrderItem_1</wsdl-message-part-name>
       <parameter-mode>IN</parameter-mode>
       </wsdl-message-mapping>
       </method-param-parts-mapping>
       <method-param-parts-mapping>
       <param-position>1</param-position>
       <param-type>org.jboss.test.webservice.samples2.Person</param-type>
       <wsdl-message-mapping>
       <wsdl-message xmlns:wsdlMsgNS="http://org.jboss.test.webservice/samples2">wsdlMsgNS:OrderProcess_processOrder</wsdl-message>
       <wsdl-message-part-name>Person_2</wsdl-message-part-name>
       <parameter-mode>IN</parameter-mode>
       </wsdl-message-mapping>
       </method-param-parts-mapping>
       <wsdl-return-value-mapping>
       <method-return-value>org.jboss.test.webservice.samples2.OrderResponse</method-return-value>
       <wsdl-message xmlns:wsdlMsgNS="http://org.jboss.test.webservice/samples2">wsdlMsgNS:OrderProcess_processOrderResponse</wsdl-message>
       <wsdl-message-part-name>result</wsdl-message-part-name>
       </wsdl-return-value-mapping>
       </service-endpoint-method-mapping>
       </service-endpoint-interface-mapping>
      </java-wsdl-mapping>
      


      From what I've read, the SOAP request looks reasonable, except that it doesn't have qualified name spaces for each element. My interpretation of the spec is that this is required, but I'm not an expert. I've looked through the forums and can see lots of interoperability issues related to qualified vs. nonqualified, but most of those seem to involve axis being unaware of the schema and sending unqualified responses. In my case, I haven't even gotten JBOSS to accept the request from the .NET client.