users@jax-rpc.java.net

Working Dii client with original wsdl-Re:Server exception when invoking web service using DII

From: kathy walsh <Kathleen.Walsh_at_Sun.COM>
Date: Wed, 03 Nov 2004 17:17:10 -0500

Adding java.net users -

kathy walsh wrote:

> Ryan-
>
> This is the dii client program that I modified and that works with your
> original wsdl-
> You will have to take a look and see what is differnt between your
> client program and this program-
>
> This may not compile as is-
> I just did a cut and paste.
> Let me know if you have questions-
>
> Kathy
> I will be posting it to the forum shortly
>
> Ryan LeCompte wrote:
>
>> Anne,
>> I would imagine that it's a bug with the DII portion of JAX-RPC RI,
>> since this WSDL works fine (without any modifications) using the
>> regular generated stub from passing this WSDL to wscompile. I was
>> really hoping to use DII, however, since it supports one-way operations.
>> -- Ryan
>>
>> ------------------------------------------------------------------------
>> *From:* Anne Thomas Manes [mailto:anne_at_manes.net]
>> *Sent:* Tuesday, November 02, 2004 6:15 PM
>> *To:* users_at_jax-rpc.dev.java.net
>> *Subject:* RE: Server exception when invoking web service using DII
>>
>> I judge this to be limitation (i.e., a bug) in the JAX-RPC RI.
>>
>> Obviously you also need to make the complexType name the same as the
>> element and the operation. I suspect that’s because JAX-RPC RI maps
>> the type name to the Java class name, and JAX-RPC directly maps the
>> incoming element name to the class name. There should be a higher
>> level of abstraction between the two, though.
>>
>> Anne
>>
>> ------------------------------------------------------------------------
>>
>> *From:* Ryan LeCompte [mailto:ryan.lecompte_at_pangonetworks.com]
>> *Sent:* Tuesday, November 02, 2004 6:04 PM
>> *To:* users_at_jax-rpc.dev.java.net
>> *Subject:* RE: Server exception when invoking web service using DII
>>
>> Anne, I tried changing just the element name of the WSDL and I'm
>> still seeing the same server-side exception. Here is the modified
>> WSDL which should work (element name now is the same as the operation
>> name, but the complex type name stays the same):
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <definitions name="TestWebService"
>> targetNamespace="urn:com.test.webservice/wsdl/TestWebService"
>> xmlns:tns="urn:com.test.webservice/wsdl/TestWebService"
>> xmlns:xsdns="urn:com.test.webservice/types/TestWebService"
>> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>> xmlns="http://schemas.xmlsoap.org/wsdl/">
>> <types>
>> <schema targetNamespace="urn:com.test.webservice/types/TestWebService"
>> xmlns:tns="urn:com.test.webservice/types/TestWebService"
>> xmlns="http://www.w3.org/2001/XMLSchema">
>>
>> <complexType name="tData">
>> <sequence>
>> <element name="arrayOfData" type="tns:tDatum" nillable="false"
>> minOccurs="1" maxOccurs="unbounded"/>
>> </sequence>
>> </complexType>
>> <complexType name="tDatum">
>> <sequence>
>> <element name="dataOne" type="string" nillable="false"/>
>> <element name="dataTwo" type="string" nillable="false"/>
>> </sequence>
>> </complexType>
>> <element name="handleData" type="tns:tData"/>
>> </schema>
>> </types>
>>
>> <message name="TestWebService_handleData">
>> <part name="parameters" element="xsdns:handleData"/>
>> </message>
>>
>> <portType name="TestWebServicePortType">
>> <operation name="handleData">
>> <input message="tns:TestWebService_handleData"/>
>> </operation>
>> </portType>
>>
>> <binding name="TestWebServiceBinding" type="tns:TestWebServicePortType">
>> <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
>> style="document"/>
>> <operation name="handleData">
>> <soap:operation soapAction="TestWebService/handleData"/>
>> <input>
>> <soap:body use="literal"/>
>> </input>
>> </operation>
>> </binding>
>>
>> <service name="TestWebService">
>> <port name="TestWebServicePort" binding="tns:TestWebServiceBinding">
>> <soap:address location="TODO REPLACE_WITH_ACTUAL_URL"/>
>> </port>
>> </service>
>> </definitions>
>>
>> ------------------------------------------------------------------------
>>
>> *From:* Anne Thomas Manes [mailto:anne_at_manes.net]
>> *Sent:* Tuesday, November 02, 2004 5:55 PM
>> *To:* users_at_jax-rpc.dev.java.net
>> *Subject:* RE: Server exception when invoking web service using DII
>>
>> I suspect that the name of the complexType is irrelevant, but the
>> name of the element must be the same as the operation name.
>>
>> The WS-I BP requires that the child element of the <soap:Body> must
>> provide a unique signature for each operation. As a good practice,
>> that element name should be the same as the operation name – it will
>> ensure much better interoperability, in any case. I agree with you
>> that you shouldn’t HAVE to follow this convention, but a number of
>> SOAP engines aren’t very good at mapping doc/literal SOAP messages to
>> WSDL operations if the operation name isn’t included in the SOAP
>> message.
>>
>> Regards,
>>
>> Anne
>>
>> ------------------------------------------------------------------------
>>
>> *From:* Ryan LeCompte [mailto:ryan.lecompte_at_pangonetworks.com]
>> *Sent:* Tuesday, November 02, 2004 5:35 PM
>> *To:* users_at_jax-rpc.dev.java.net
>> *Subject:* RE: Server exception when invoking web service using DII
>>
>> Anne,
>>
>> I actually originally had it removed from the soap:body definition,
>> but ended up adding it just to try something new to get this problem
>> resolved. I'm still trying to solve this problem, since the only way
>> it seems to work with DII is to name the complex type/element the
>> same name as the operation name. I'd really love to get this working
>> without having to name elements this way.
>>
>> Regards,
>>
>> -- Ryan
>>
>> ------------------------------------------------------------------------
>>
>> *From:* Anne Thomas Manes [mailto:anne_at_manes.net]
>> *Sent:* Tuesday, November 02, 2004 5:35 PM
>> *To:* users_at_jax-rpc.dev.java.net
>> *Subject:* RE: Server exception when invoking web service using DII
>>
>> Ryan,
>>
>> You should also remove the namespace attribute from the <soap:body>
>> definition:
>>
>> <soap:body use="literal"/>
>>
>> Anne
>>
>> ------------------------------------------------------------------------
>>
>> *From:* Ryan LeCompte [mailto:ryan.lecompte_at_pangonetworks.com]
>> *Sent:* Tuesday, November 02, 2004 10:23 AM
>> *To:* 'kathy walsh'; users_at_jax-rpc.dev.java.net
>> *Subject:* RE: Server exception when invoking web service using DII
>>
>> Kathy,
>>
>> I modified the WSDL since you previously mentioned that I should
>> first try to get the namespaces issue sorted out before tweaking the
>> generated serializer code. Here is the modfiied WSDL:
>>
>> Note that the complex type is now "handleData" as well as the element
>> name. This is the only way that the DII client works, unfortunately.
>>
>> Thank you for your time!
>>
>> -- Ryan
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <definitions name="TestWebService"
>> targetNamespace="urn:com.test.webservice/wsdl/TestWebService"
>> xmlns:tns="urn:com.test.webservice/wsdl/TestWebService"
>> xmlns="http://schemas.xmlsoap.org/wsdl/"
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>> xmlns:ns2="urn:com.test.webservice/types/TestWebService">
>> <types>
>> <schema targetNamespace="urn:com.test.webservice/types/TestWebService"
>> xmlns:tns="urn:com.test.webservice/types/TestWebService"
>> 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="handleData">
>> <sequence>
>> <element name="arrayOfData" type="tns:tDatum" nillable="false"
>> minOccurs="1" maxOccurs="unbounded"/>
>> </sequence>
>> </complexType>
>> <complexType name="tDatum">
>> <sequence>
>> <element name="dataOne" type="string" nillable="false"/>
>> <element name="dataTwo" type="string" nillable="false"/>
>> </sequence>
>> </complexType>
>> <element name="handleData" type="tns:handleData"/>
>> </schema>
>> </types>
>>
>> <message name="TestWebService_handleData">
>> <part name="parameters" element="ns2:handleData"/>
>> </message>
>>
>> <portType name="TestWebService">
>> <operation name="handleData">
>> <input message="tns:TestWebService_handleData"/>
>> </operation>
>> </portType>
>>
>> <binding name="TestWebServiceBinding" type="tns:TestWebService">
>> <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
>> style="document"/>
>> <operation name="handleData">
>> <soap:operation soapAction="TestWebService/handleData"/>
>> <input>
>> <soap:body use="literal"
>> namespace="urn:com.test.webservice/wsdl/TestWebService"/>
>> </input>
>> </operation>
>> </binding>
>>
>> <service name="TestWebService">
>> <port name="TestWebServicePort" binding="tns:TestWebServiceBinding">
>> <soap:address location="TODO REPLACE_WITH_ACTUAL_URL"/>
>> </port>
>> </service>
>> </definitions>
>>
>> ------------------------------------------------------------------------
>>
>> *From:* kathy walsh [mailto:Kathleen.Walsh_at_Sun.COM]
>> *Sent:* Tuesday, November 02, 2004 10:24 AM
>> *To:* users_at_jax-rpc.dev.java.net
>> *Cc:* 'Ryan LeCompte'
>> *Subject:* Re: Server exception when invoking web service using DII
>>
>> Ryan-
>> I am not sure why you changed your wsdl-
>> If you could please send the modified wsdl.
>>
>> I will look further into what you are doing today-
>> thanks,
>> Kathy
>>
>> Ryan LeCompte wrote:
>>
>> Kathy,
>>
>> I was able to modify the WSDL further so that it works with DII. I
>> basically made the custom WSDL look almost identical to what
>> wscompile would automatically generate if given the regular Java
>> endpoint interface. However, I'm quite puzzled as to why DII requires
>> the WSDL to look this way. It started working once I changed the
>> <complexType name="tData"> to be <complexType name="handleData"> and
>> also when I changed <element name="data" type="tns:tData"/> to be
>> <element name="data" type="tns:handleData"/>. It appears that DII
>> will only work when the name of the complex type is exactly the same
>> as the name of an operation (note that there is a single operation
>> named "handleData"). Otherwise, I get the server-side exception:
>>
>> Nov 2, 2004 9:33:02 AM com.sun.xml.rpc.server.StreamingHandler handle
>> SEVERE: unrecognized operation:
>> {urn:com.test.webservice/types/TestWebService}Da
>> ta
>> unrecognized operation:
>> {urn:com.test.webservice/types/TestWebService}Data
>> at com.test.webservice.TestWebService_PortType_Tie.peekFirstBodyElement(
>> TestWebService_PortType_Tie.java:76)
>>
>> Etc...
>>
>> I really would hate having to name the complex types exactly the way
>> that the operations are named, since this makes the WSDL a bit harder
>> to read. Is there something that I'm not doing (perhaps
>> namespace-related) that is only making this WSDL work when the
>> complex types are named the same as the operations?
>>
>> Thank you,
>>
>> -- Ryan
>>
>> ------------------------------------------------------------------------
>>
>> *From:* Ryan LeCompte [mailto:ryan.lecompte_at_pangonetworks.com]
>> *Sent:* Monday, November 01, 2004 9:03 PM
>> *To:* 'users_at_jax-rpc.dev.java.net <mailto:users_at_jax-rpc.dev.java.net>'
>> *Subject:* RE: Server exception when invoking web service using DII
>>
>> Kathy,
>>
>> I used the tcpmon utility to capture the incoming SOAP messages for
>> the stub-based and DII-based clients. I also modified the WSDL a bit
>> in hopes of getting it in a form that will work with DII, but I'm
>> still seeing the SOAP fault (exception in server). Here is the
>> modified WSDL file and SOAP snippets from the tcpmon utility:
>>
>> I. WSDL
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <definitions name="TestWebService"
>> targetNamespace="urn:com.test.webservice/wsdl/TestWebService"
>> xmlns:tns="urn:com.test.webservice/wsdl/TestWebService"
>> xmlns="http://schemas.xmlsoap.org/wsdl/"
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>> xmlns:ns2="urn:com.test.webservice/types/TestWebService">
>> <types>
>> <schema targetNamespace="urn:com.test.webservice/types/TestWebService"
>> xmlns:tns="urn:com.test.webservice/types/TestWebService"
>> 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="tData">
>> <sequence>
>> <element name="arrayOfData" type="tns:tDatum" nillable="false"
>> minOccurs="1" maxOccurs="unbounded"/>
>> </sequence>
>> </complexType>
>> <complexType name="tDatum">
>> <sequence>
>> <element name="dataOne" type="string" nillable="false"/>
>> <element name="dataTwo" type="string" nillable="false"/>
>> </sequence>
>> </complexType>
>> <element name="data" type="tns:tData"/>
>> </schema>
>> </types>
>>
>> <message name="TestWebService_handleData">
>> <part name="parameters" element="ns2:data"/>
>> </message>
>>
>> <portType name="TestWebServicePortType">
>> <operation name="handleData">
>> <input message="tns:TestWebService_handleData"/>
>> </operation>
>> </portType>
>>
>> <binding name="TestWebServiceBinding" type="tns:TestWebServicePortType">
>> <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
>> style="document"/>
>> <operation name="handleData">
>> <soap:operation soapAction="TestWebService/handleData"/>
>> <input>
>> <soap:body use="literal"/>
>> </input>
>> </operation>
>> </binding>
>>
>> <service name="TestWebService">
>> <port name="TestWebServicePort" binding="tns:TestWebServiceBinding">
>> <soap:address location="TODO REPLACE_WITH_ACTUAL_URL"/>
>> </port>
>> </service>
>> </definitions>
>>
>> II. SOAP message for stub-based client
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>>
>> <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
>> <http://schemas.xmlsoap.org/soap/envelope/>
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>> <http://www.w3.org/2001/XMLSchema>
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> <http://www.w3.org/2001/XMLSchema-instance>
>> xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"
>> <http://schemas.xmlsoap.org/soap/encoding/>
>> xmlns:ns0="urn:com.test.webservice/types/TestWebService">
>>
>> <env:Body>
>>
>> <ns0:data>
>>
>> <arrayOfData>
>>
>> <dataOne>One</dataOne>
>>
>> <dataTwo>Two</dataTwo>
>>
>> </arrayOfData>
>>
>> </ns0:data>
>>
>> </env:Body>
>>
>> </env:Envelope>
>>
>> III. SOAP message for DII-based client
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>>
>> <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
>> <http://schemas.xmlsoap.org/soap/envelope/>
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>> <http://www.w3.org/2001/XMLSchema>
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> <http://www.w3.org/2001/XMLSchema-instance>
>> xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"
>> <http://schemas.xmlsoap.org/soap/encoding/>>
>>
>> <env:Body>
>>
>> <ans1:tData xmlns:ans1="urn:com.test.webservice/types/TestWebService">
>>
>> <arrayOfData>
>>
>> <dataOne>One</dataOne>
>>
>> <dataTwo>Two</dataTwo>
>>
>> </arrayOfData>
>>
>> </ans1:tData>
>>
>> </env:Body>
>>
>> </env:Envelope>
>>
>> Which generates the following fault response:
>>
>> HTTP/1.1 500 Internal Server Error
>>
>> SOAPAction: ""
>>
>> Content-Type: text/xml;charset=utf-8
>>
>> Transfer-Encoding: chunked
>>
>> Date: Tue, 02 Nov 2004 01:51:15 GMT
>>
>> Server: Sun-Java-System/Web-Services-Pack-1.4
>>
>> Connection: close
>>
>> 236
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>>
>> <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
>> <http://schemas.xmlsoap.org/soap/envelope/>
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>> <http://www.w3.org/2001/XMLSchema>
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> <http://www.w3.org/2001/XMLSchema-instance>
>> xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"
>> <http://schemas.xmlsoap.org/soap/encoding/>
>> xmlns:ns0="urn:com.test.webservice/types/TestWebService">
>>
>> <env:Body>
>>
>> <env:Fault>
>>
>> <faultcode>env:Client</faultcode>
>>
>> <faultstring>JAXRPCTIE01: caught exception while handling request:
>> unrecognized operation:
>> {urn:com.test.webservice/types/TestWebService}tData</faultstring>
>>
>> </env:Fault>
>>
>> </env:Body>
>>
>> </env:Envelope>
>>
>> I'm still not sure if I have the operations defined with a namespace
>> as you mentioned. Any further insight you can provide is much
>> appreciated!
>>
>> Regards,
>>
>> -- Ryan
>>
>> ------------------------------------------------------------------------
>>
>> *From:* kathy walsh [mailto:Kathleen.Walsh_at_Sun.COM]
>> *Sent:* Monday, November 01, 2004 4:21 PM
>> *To:* users_at_jax-rpc.dev.java.net <mailto:users_at_jax-rpc.dev.java.net>
>> *Subject:* Re: Server exception when invoking web service using DII
>>
>> If you can view the xml stream that is output from both the
>> stub and the dii client using a tool like tcptunnel or tcpMonitor-
>> or write one yourself-
>> By viewing the differences, you may see what is not serializing
>> properly.
>> In order to tweak the serializer you need to use the -keep option
>> with wscompile
>> Based on what you find, review the generated serializer code and
>> examine look at
>> the area that you have found that is different on the sent dii xml
>> stream.
>> Try tweaking that area of code
>>
>> Another thought is that there is no namespace set on the operation .
>> Literal web services with dii and dynamic proxies will error if
>> the namespaces are not set correctly-I would try this first before
>> teaking the serializer.
>>
>> Kathy
>>
>> Ryan LeCompte wrote:
>>
>> Kathy,
>>
>> Thank you for responding. You mention that I may have to tweak the
>> generated serializer code from wscompile to make this work with DII.
>> Can you shed a bit more guidance in how I would go about doing that?
>> What would need to change?
>>
>> Thank you,
>>
>> -- Ryan
>>
>> ------------------------------------------------------------------------
>>
>> *From:* kathy walsh [mailto:Kathleen.Walsh_at_Sun.COM]
>> *Sent:* Monday, November 01, 2004 3:50 PM
>> *To:* users_at_jax-rpc.dev.java.net <mailto:users_at_jax-rpc.dev.java.net>
>> *Subject:* Re: Server exception when invoking web service using DII
>>
>> Ryan-
>>
>> You may have to tweak the serializer code generated from
>> wscompile in order to use this with a DII client.
>> Let me know if you need more help with this-
>> Kathy
>>
>>
>> Ryan LeCompte wrote:
>>
>> Hello,
>>
>> I'm having a problem invoking a JAX-RPC web service implementation
>> that is generated from a custom WSDL file using DII in a JAX-RPC
>> client. I can invoke this web service using generated stubs without
>> any problems. When I invoke the remote web service using DII, an
>> exception is generated on the server. I'm using JWSDP 1.4. I've
>> attempted to write a fairly small "test" WSDL and JAX-RPC client to
>> demonstrate the problem:
>>
>> I. TestWebService WSDL
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <definitions name="TestWebService"
>> targetNamespace="urn:com.test.webservice/wsdl"
>> xmlns:tns="urn:com.test.webservice/wsdl"
>> xmlns:xsdns="urn:com.test.webservice/types"
>> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>> xmlns="http://schemas.xmlsoap.org/wsdl/">
>> <types>
>> <schema targetNamespace="urn:com.test.webservice/types"
>> xmlns:tns="urn:com.test.webservice/types"
>> xmlns="http://www.w3.org/2001/XMLSchema">
>>
>> <complexType name="tData">
>> <sequence>
>> <element name="arrayOfData" type="tns:tDatum" nillable="false"
>> minOccurs="1" maxOccurs="unbounded"/>
>> </sequence>
>> </complexType>
>> <complexType name="tDatum">
>> <sequence>
>> <element name="dataOne" type="string" nillable="false"/>
>> <element name="dataTwo" type="string" nillable="false"/>
>> </sequence>
>> </complexType>
>> <element name="data" type="tns:tData"/>
>> </schema>
>> </types>
>>
>> <message name="TestWebService_handleData">
>> <part name="parameters" element="xsdns:data"/>
>> </message>
>>
>> <portType name="TestWebServicePortType">
>> <operation name="handleData">
>> <input message="tns:TestWebService_handleData"/>
>> </operation>
>> </portType>
>>
>> <binding name="TestWebServiceBinding" type="tns:TestWebServicePortType">
>> <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
>> style="document"/>
>> <operation name="handleData">
>> <soap:operation soapAction="TestWebService/handleData"/>
>> <input>
>> <soap:body use="literal"/>
>> </input>
>> </operation>
>> </binding>
>>
>> <service name="TestWebService">
>> <port name="TestWebServicePort" binding="tns:TestWebServiceBinding">
>> <soap:address location="TODO REPLACE_WITH_ACTUAL_URL"/>
>> </port>
>> </service>
>> </definitions>
>>
>> II. Test JAX-RPC client using stubs and DII
>>
>> -- note that the server exception is generated only when the DII
>> Call.invokeOneWay is executed, not the stub call
>>
>> -- also note that the method registerSerializers() was added since it
>> appears that the custom serializers must be registered explicitly in
>> the client code (the register serializer code was essentially
>> copied/pasted from the auto-generated code from wscompile)
>>
>> public class TestWebServiceClient implements SerializerConstants {
>> private static final String SERVICE_URI =
>> "urn:com.test.webservice/wsdl";
>>
>> public static void main(String[] args) {
>> String STUB_ADDR = "http://localhost:8080/TestService/TestWebService";
>> String DII_ADDR =
>> "http://localhost:8080/TestService/TestWebService?WSDL";
>>
>> try {
>> TestWebService_Impl serviceImpl = new TestWebService_Impl();
>> TestWebServicePortType stub =
>> (TestWebServicePortType)serviceImpl.getTestWebServicePort();
>> ((Stub)stub)._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, STUB_ADDR);
>>
>> // Create and send multiple Datum objects via stub.
>> TDatum[] data = new TDatum[5];
>> for (int i = 0; i < data.length; i++) {
>> data[i] = new TDatum();
>> data[i].setDataOne("One");
>> data[i].setDataTwo("Two");
>> }
>> stub.handleData(data);
>>
>> // Create and send multiple Datum objects via DII.
>> String BODY_NAMESPACE_VALUE = SERVICE_URI;
>> String ENCODING_STYLE_PROPERTY
>> ="javax.xml.rpc.encodingstyle.namespace.uri";
>> String serviceName = "TestWebService";
>> String portName = "TestWebServicePort";
>> Service service = null;
>> QName port = null;
>> ServiceFactory factory = ServiceFactory.newInstance();
>> service = factory.createService(new URL(DII_ADDR), new
>> QName(BODY_NAMESPACE_VALUE, serviceName));
>>
>> registerSerializers(service);
>> port = new QName(BODY_NAMESPACE_VALUE, portName);
>> QName operation = new QName("handleData");
>> Call call = service.createCall(port, operation);
>> call.setProperty(Call.SOAPACTION_USE_PROPERTY, new Boolean(true));
>> call.setProperty(Call.SOAPACTION_URI_PROPERTY,
>> "TestWebService/handleData");
>> call.setProperty(ENCODING_STYLE_PROPERTY, "");
>> call.setProperty(Call.OPERATION_STYLE_PROPERTY, "document");
>> Object[] params = new Object[] { new TData(data) };
>> call.invokeOneWay(params);
>> } catch (Throwable t) {
>> t.printStackTrace();
>> }
>> }
>>
>> private static void registerSerializers(Service service) {
>> TypeMappingRegistry registry = service.getTypeMappingRegistry();
>> TypeMapping mapping12 =
>> registry.getTypeMapping(SOAP12Constants.NS_SOAP_ENCODING);
>> TypeMapping mapping =
>> registry.getTypeMapping(SOAPConstants.NS_SOAP_ENCODING);
>> TypeMapping mapping2 = registry.getTypeMapping("");
>>
>> {
>> QName type = new QName("urn:com.test.webservice/types", "tData");
>> CombinedSerializer serializer = new
>> com.test.webservice.TData_LiteralSerializer(type, "", DONT_ENCODE_TYPE);
>> registerSerializer(mapping2,com.test.webservice.TData.class, type,
>> serializer);
>> }
>> {
>> QName type = new QName("urn:com.test.webservice/types", "tDatum");
>> CombinedSerializer serializer = new
>> com.test.webservice.TDatum_LiteralSerializer(type, "",
>> DONT_ENCODE_TYPE);
>> registerSerializer(mapping2,com.test.webservice.TDatum.class, type,
>> serializer);
>> }
>> }
>>
>> private static void registerSerializer(TypeMapping mapping, Class
>> javaType, QName xmlType,
>> Serializer ser) {
>> mapping.register(javaType, xmlType, new SingletonSerializerFactory(ser),
>> new SingletonDeserializerFactory((Deserializer)ser));
>> }
>>
>> }
>>
>> III. Server-side exception
>>
>> When I invoke the remote web service using DII, the following
>> exception is generated on the server:
>>
>> Nov 1, 2004 2:20:24 PM com.sun.xml.rpc.server.StreamingHandler handle
>> SEVERE: unrecognized operation: {urn:com.test.webservice/types}tData
>> unrecognized operation: {urn:com.test.webservice/types}tData
>> at com.test.webservice.TestWebServicePortType_Tie.peekFirstBodyElement(T
>> estWebServicePortType_Tie.java:76)
>> at com.sun.xml.rpc.server.StreamingHandler.handle(StreamingHandler.java:
>> 218)
>> at com.sun.xml.rpc.server.http.JAXRPCServletDelegate.doPost(JAXRPCServle
>> tDelegate.java:443)
>> at com.sun.xml.rpc.server.http.JAXRPCServlet.doPost(JAXRPCServlet.java:8
>> 6)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
>> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
>> icationFilterChain.java:237)
>> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
>> ilterChain.java:157)
>> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
>> alve.java:214)
>> at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
>> eContext.java:104)
>> at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
>> a:520)
>> at org.apache.catalina.core.StandardContextValve.invokeInternal(Standard
>> ContextValve.java:198)
>> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
>> alve.java:152)
>> at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
>> eContext.java:104)
>> at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
>> a:520)
>> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
>> ava:137)
>> at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
>> eContext.java:104)
>> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
>> ava:117)
>> at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
>> eContext.java:102)
>> at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
>> a:520) ...... (rest of exception omitted)
>>
>> At first I thought that there was a problem with my WSDL, but that
>> shouldn't be the case since the stub-based JAX-RPC client code works
>> without any problems. Also, the DII code doesn't generate any
>> client-side exceptions when invoked.
>>
>> Any help is much appreciated!
>>
>> Regards,
>>
>> -- Ryan
>>
>------------------------------------------------------------------------
>
>public class RyanClient {
>
>private String BODY_NAMESPACE_VALUE = "urn:com.test.webservice/wsdl";
>
>public void testDIIComplexType() {
> try {
>
> // Create and send multiple Datum objects via stub.
> TDatum data = new TDatum("one", "two");
> TDatum data2 = new TDatum("three", "four");
> TDatum[] arrayofTDatum = new TDatum[]{data, data2};
>
> TData tdata = new TData(arrayofTDatum);
>
> String ENCODING_STYLE_PROPERTY = "javax.xml.rpc.encodingstyle.namespace.uri";
> String serviceName = "TestWebService";
> String portName = "TestWebServicePort";
> Service service = null;
> QName port = null;
> ServiceFactory factory = ServiceFactory.newInstance();
> service = factory.createService(wsdlURL, new QName(BODY_NAMESPACE_VALUE, serviceName));
> port = new QName(BODY_NAMESPACE_VALUE, portName);
> QName operation = new QName(BODY_NAMESPACE_VALUE, "handleData");
>
> getRegistry(service);
>
>
> Call call = service.createCall(port, operation);
> call.setProperty(Call.SOAPACTION_USE_PROPERTY, new Boolean(true));
> call.setProperty(Call.SOAPACTION_URI_PROPERTY, "TestWebService/handleData");
> call.setProperty(ENCODING_STYLE_PROPERTY, "");
> call.setProperty(Call.OPERATION_STYLE_PROPERTY, "document");
> Object[] params = new Object[]{tdata};
> call.invokeOneWay(params);
>
> } catch (Exception ex) {
> ex.printStackTrace();
> }
> }
>
>
> public TypeMappingRegistry getRegistry(Service service) {
> TypeMappingRegistry registry = service.getTypeMappingRegistry();
>
> TypeMapping mapping12 = registry.getTypeMapping(SOAP12Constants.NS_SOAP_ENCODING);
> TypeMapping mapping = registry.getTypeMapping(SOAPConstants.NS_SOAP_ENCODING);
> TypeMapping mapping2 = registry.getTypeMapping("");
> {
> QName type = new QName("urn:com.test.webservice/types", "tData");
> CombinedSerializer serializer = new customer_tests.dii_complex_doclit.client.TData_LiteralSerializer(type, "", DONT_ENCODE_TYPE);
> registerSerializer(mapping2, customer_tests.dii_complex_doclit.client.TData.class, type, serializer);
> }
> {
> QName type = new QName("urn:com.test.webservice/types", "tDatum");
> CombinedSerializer serializer = new customer_tests.dii_complex_doclit.client.TDatum_LiteralSerializer(type, "", DONT_ENCODE_TYPE);
> registerSerializer(mapping2, customer_tests.dii_complex_doclit.client.TDatum.class, type, serializer);
> }
> return registry;
> }
>
> private static void registerSerializer(TypeMapping mapping, Class javaType, QName xmlType,
> Serializer ser) {
> mapping.register(javaType, xmlType, new SingletonSerializerFactory(ser),
> new SingletonDeserializerFactory((Deserializer) ser));
> }
>
>}
>
>
>------------------------------------------------------------------------
>
>// This class was generated by the JAXRPC SI, do not edit.
>// Contents subject to change without notice.
>// JAX-RPC Standard Implementation (1.1.2_01, build R35)
>// Generated source version: 1.1.2
>
>package customer_tests.dii_complex_doclit.client;
>
>import com.sun.xml.rpc.encoding.*;
>import com.sun.xml.rpc.encoding.xsd.XSDConstants;
>import com.sun.xml.rpc.encoding.literal.*;
>import com.sun.xml.rpc.encoding.literal.DetailFragmentDeserializer;
>import com.sun.xml.rpc.encoding.simpletype.*;
>import com.sun.xml.rpc.encoding.soap.SOAPConstants;
>import com.sun.xml.rpc.encoding.soap.SOAP12Constants;
>import com.sun.xml.rpc.streaming.*;
>import com.sun.xml.rpc.wsdl.document.schema.SchemaConstants;
>import javax.xml.namespace.QName;
>import java.util.List;
>import java.util.ArrayList;
>
>public class TDatum_LiteralSerializer extends LiteralObjectSerializerBase implements Initializable {
> private static final QName ns1_dataOne_QNAME = new QName("", "dataOne");
> private static final QName ns2_string_TYPE_QNAME = SchemaConstants.QNAME_TYPE_STRING;
> private CombinedSerializer ns2_myns2_string__java_lang_String_String_Serializer;
> private static final QName ns1_dataTwo_QNAME = new QName("", "dataTwo");
>
> public TDatum_LiteralSerializer(QName type, String encodingStyle) {
> this(type, encodingStyle, false);
> }
>
> public TDatum_LiteralSerializer(QName type, String encodingStyle, boolean encodeType) {
> super(type, true, encodingStyle, encodeType);
> }
>
> public void initialize(InternalTypeMappingRegistry registry) throws Exception {
> ns2_myns2_string__java_lang_String_String_Serializer = (CombinedSerializer)registry.getSerializer("", java.lang.String.class, ns2_string_TYPE_QNAME);
> }
>
> public Object doDeserialize(XMLReader reader,
> SOAPDeserializationContext context) throws Exception {
> customer_tests.dii_complex_doclit.client.TDatum instance = new customer_tests.dii_complex_doclit.client.TDatum();
> Object member=null;
> QName elementName;
> List values;
> Object value;
>
> reader.nextElementContent();
> elementName = reader.getName();
> if (reader.getState() == XMLReader.START) {
> if (elementName.equals(ns1_dataOne_QNAME)) {
> member = ns2_myns2_string__java_lang_String_String_Serializer.deserialize(ns1_dataOne_QNAME, reader, context);
> if (member == null) {
> throw new DeserializationException("literal.unexpectedNull");
> }
> instance.setDataOne((java.lang.String)member);
> reader.nextElementContent();
> } else {
> throw new DeserializationException("literal.unexpectedElementName", new Object[] { ns1_dataOne_QNAME, reader.getName() });
> }
> }
> else {
> throw new DeserializationException("literal.expectedElementName", reader.getName().toString());
> }
> elementName = reader.getName();
> if (reader.getState() == XMLReader.START) {
> if (elementName.equals(ns1_dataTwo_QNAME)) {
> member = ns2_myns2_string__java_lang_String_String_Serializer.deserialize(ns1_dataTwo_QNAME, reader, context);
> if (member == null) {
> throw new DeserializationException("literal.unexpectedNull");
> }
> instance.setDataTwo((java.lang.String)member);
> reader.nextElementContent();
> } else {
> throw new DeserializationException("literal.unexpectedElementName", new Object[] { ns1_dataTwo_QNAME, reader.getName() });
> }
> }
> else {
> throw new DeserializationException("literal.expectedElementName", reader.getName().toString());
> }
>
> XMLReaderUtil.verifyReaderState(reader, XMLReader.END);
> return (Object)instance;
> }
>
> public void doSerializeAttributes(Object obj, XMLWriter writer, SOAPSerializationContext context) throws Exception {
> customer_tests.dii_complex_doclit.client.TDatum instance = (customer_tests.dii_complex_doclit.client.TDatum)obj;
>
> }
> public void doSerialize(Object obj, XMLWriter writer, SOAPSerializationContext context) throws Exception {
> customer_tests.dii_complex_doclit.client.TDatum instance = (customer_tests.dii_complex_doclit.client.TDatum)obj;
>
> if (instance.getDataOne() == null) {
> throw new SerializationException("literal.unexpectedNull");
> }
> ns2_myns2_string__java_lang_String_String_Serializer.serialize(instance.getDataOne(), ns1_dataOne_QNAME, null, writer, context);
> if (instance.getDataTwo() == null) {
> throw new SerializationException("literal.unexpectedNull");
> }
> ns2_myns2_string__java_lang_String_String_Serializer.serialize(instance.getDataTwo(), ns1_dataTwo_QNAME, null, writer, context);
> }
>}
>
>
>------------------------------------------------------------------------
>
>// This class was generated by the JAXRPC SI, do not edit.
>// Contents subject to change without notice.
>// JAX-RPC Standard Implementation (1.1.2_01, build R35)
>// Generated source version: 1.1.2
>
>package customer_tests.dii_complex_doclit.client;
>
>import com.sun.xml.rpc.encoding.*;
>import com.sun.xml.rpc.encoding.xsd.XSDConstants;
>import com.sun.xml.rpc.encoding.literal.*;
>import com.sun.xml.rpc.encoding.literal.DetailFragmentDeserializer;
>import com.sun.xml.rpc.encoding.simpletype.*;
>import com.sun.xml.rpc.encoding.soap.SOAPConstants;
>import com.sun.xml.rpc.encoding.soap.SOAP12Constants;
>import com.sun.xml.rpc.streaming.*;
>import com.sun.xml.rpc.wsdl.document.schema.SchemaConstants;
>import javax.xml.namespace.QName;
>import java.util.List;
>import java.util.ArrayList;
>
>public class TData_LiteralSerializer extends LiteralObjectSerializerBase implements Initializable {
> private static final QName ns1_arrayOfData_QNAME = new QName("", "arrayOfData");
> private static final QName ns3_tDatum_TYPE_QNAME = new QName("urn:com.test.webservice/types", "tDatum");
> private CombinedSerializer ns3_myTDatum_LiteralSerializer;
>
> public TData_LiteralSerializer(QName type, String encodingStyle) {
> this(type, encodingStyle, false);
> }
>
> public TData_LiteralSerializer(QName type, String encodingStyle, boolean encodeType) {
> super(type, true, encodingStyle, encodeType);
> }
>
> public void initialize(InternalTypeMappingRegistry registry) throws Exception {
> ns3_myTDatum_LiteralSerializer = (CombinedSerializer)registry.getSerializer("", customer_tests.dii_complex_doclit.client.TDatum.class, ns3_tDatum_TYPE_QNAME);
> }
>
> public Object doDeserialize(XMLReader reader,
> SOAPDeserializationContext context) throws Exception {
> customer_tests.dii_complex_doclit.client.TData instance = new customer_tests.dii_complex_doclit.client.TData();
> Object member=null;
> QName elementName;
> List values;
> Object value;
>
> reader.nextElementContent();
> elementName = reader.getName();
> if ((reader.getState() == XMLReader.START) && (elementName.equals(ns1_arrayOfData_QNAME))) {
> values = new ArrayList();
> for(;;) {
> elementName = reader.getName();
> if ((reader.getState() == XMLReader.START) && (elementName.equals(ns1_arrayOfData_QNAME))) {
> value = ns3_myTDatum_LiteralSerializer.deserialize(ns1_arrayOfData_QNAME, reader, context);
> if (value == null) {
> throw new DeserializationException("literal.unexpectedNull");
> }
> values.add(value);
> reader.nextElementContent();
> } else {
> break;
> }
> }
> member = new customer_tests.dii_complex_doclit.client.TDatum[values.size()];
> member = values.toArray((Object[]) member);
> instance.setArrayOfData((customer_tests.dii_complex_doclit.client.TDatum[])member);
> }
> else if(!(reader.getState() == XMLReader.END)) {
> throw new DeserializationException("literal.expectedElementName", reader.getName().toString());
> }
>
> XMLReaderUtil.verifyReaderState(reader, XMLReader.END);
> return (Object)instance;
> }
>
> public void doSerializeAttributes(Object obj, XMLWriter writer, SOAPSerializationContext context) throws Exception {
> customer_tests.dii_complex_doclit.client.TData instance = (customer_tests.dii_complex_doclit.client.TData)obj;
>
> }
> public void doSerialize(Object obj, XMLWriter writer, SOAPSerializationContext context) throws Exception {
> customer_tests.dii_complex_doclit.client.TData instance = (customer_tests.dii_complex_doclit.client.TData)obj;
>
> if (instance.getArrayOfData() != null) {
> for (int i = 0; i < instance.getArrayOfData().length; ++i) {
> ns3_myTDatum_LiteralSerializer.serialize(instance.getArrayOfData()[i], ns1_arrayOfData_QNAME, null, writer, context);
> }
> }
> }
>}
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net