Ryan-
I just took a look at the wsdl's you have sent-
For document literal Services the wsdl needs to define Elements for the
parameters
which it appears that you are doing for the revised wsdl-
You will also need to set the soap action URI as this is set on the wsdl
binding chile operation-
Kathy
Ryan LeCompte wrote:
> 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'
>> *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/"
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns:enc="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/"
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns:enc="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/"
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns:enc="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
>> *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
>>> *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
>>>>
>>>>
>>>
---------------------------------------------------------------------
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