dev@jax-ws.java.net

RE: Re: Invoking a .NET web service using JAX-WS 2.0

From: Ryan LeCompte <Ryan.LeCompte_at_pangonetworks.com>
Date: Wed, 23 Aug 2006 14:29:54 -0400

I have more information that I failed to include in the previous e-mails. I thought that my Java WS 2.0 client --> Java endpoint worked as expected, but looking more closely at the output I'm seeing that it doesn't. I just noticed that instead of instantiating the proper sub-type on the endpoint side, it's actually just taking the incoming SOAP message and instantiating the base type. So in the examle that I provided it would instantiate "Base" and not "SubOne", since the SOAP message only seems to include the base attribute and not the attribute of the SubOne type. So, it looks like the .NET stack dismisses the SOAP message produced from JAX-WS 2.0 entirely, while the JWSDP will process the incoming SOAP message and just create an instance of the base type as opposed to the proper sub type.
 
I hope this additional information proves useful in diagnosing the problem.
 
Thanks,
Ryan

________________________________

From: Ryan LeCompte
Sent: Wed 8/23/2006 2:08 PM
To: dev_at_jax-ws.dev.java.net
Cc: Vivek.Pandey_at_Sun.COM
Subject: RE: Re: Invoking a .NET web service using JAX-WS 2.0



Jitendra,

Thanks for your suggestion. I installed HttpLook to capture the HTTP traffic generated from my JAX-WS 2.0 client. I also captured the HTTP traffic for a .NET client that I wrote that does the same thing as the JAX-WS 2.0 client. The .NET client successfully invokes the remote .NET endpoint, however the JAX-WS 2.0 client does not. My .NET endpoint simply writes whatever value it receives to a text file. Please see the captured traffic below. If you compare the two SOAP messages, you'll notice that the JAX-WS 2.0 client is NOT including the "attributeTwo" field of the "SubOne" object, but the .NET example is. So, it looks like the JAX-WS 2.0 client is failing to handle the base/sub-type relationship.

 

Simple JAX-WS 2.0 client:

----------------------------------------------------------

        Example service = new Example();
        ExamplePortType stub = service.getExamplePort();
        ((BindingProvider) stub).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://server/Example.asmx");
        SubOne subOne = new SubOne();
        subOne.setAttributeOne(1);
        subOne.setAttributeTwo(5);
        List<Base> values = new ArrayList<Base>();
        values.add(subOne);
        stub.foo(values);

 

Simple .NET client:

------------------------------------------------------------

Example exampleProxy = new Example();

SubOne subOne = new SubOne();

subOne.attributeOne = 1;

subOne.attributeTwo = 10;

Base[] values = new Base[1];

values[0] = subOne;

exampleProxy.foo(values);

 

HTTP traffic for the JAX-WS 2.0 client (not working):

------------------------------------------------------------------------------------

POST /Example.asmx HTTP/1.1
Content-Length: 309
SOAPAction: "Example/foo"
Content-Type: text/xml; charset=utf-8
Accept: text/xml, application/xop+xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
User-Agent: Java/1.5.0_06
Host: server
Connection: keep-alive

<?xml version="1.0" ?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="1http://www.company.com/services/Example"><soapenv:Body><ns1:foo><values><attributeOne>1</attributeOne></values></ns1:foo></soapenv:Body></soapenv:Envelope <http://www.company.com/services/Example"><soapenv:Body><ns1:foo><values><attributeOne>1</attributeOne></values></ns1:foo></soapenv:Body></soapenv:Envelope> >


HTTP/1.1 202 Accepted
Date: Wed, 23 Aug 2006 17:51:47 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 1.1.4322
Cache-Control: private
Content-Length: 0

 

 

HTTP traffic for the .NET client (working):

-----------------------------------------------------------

POST /Example.asmx HTTP/1.1

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 1.1.4322.2032)

Content-Type: text/xml; charset=utf-8

SOAPAction: "Example/foo"

Content-Length: 464

Expect: 100-continue

Connection: Keep-Alive

Host: server

HTTP/1.1 100 Continue

000000 3C 3F 78 6D 6C 20 76 65 72 73 69 6F 6E 3D 22 31 <?xml version="1

000010 2E 30 22 20 65 6E 63 6F 64 69 6E 67 3D 22 75 74 .0" encoding="ut

000020 66 2D 38 22 3F 3E 3C 73 6F 61 70 3A 45 6E 76 65 f-8"?><soap:Enve

000030 6C 6F 70 65 20 78 6D 6C 6E 73 3A 73 6F 61 70 3D lope xmlns:soap=

000040 22 68 74 74 70 3A 2F 2F 73 63 68 65 6D 61 73 2E "http://schemas.

000050 78 6D 6C 73 6F 61 70 2E 6F 72 67 2F 73 6F 61 70 xmlsoap.org/soap

000060 2F 65 6E 76 65 6C 6F 70 65 2F 22 20 78 6D 6C 6E /envelope/" xmln

000070 73 3A 78 73 69 3D 22 68 74 74 70 3A 2F 2F 77 77 s:xsi="http://ww

000080 77 2E 77 33 2E 6F 72 67 2F 32 30 30 31 2F 58 4D w.w3.org/2001/XM

000090 4C 53 63 68 65 6D 61 2D 69 6E 73 74 61 6E 63 65 LSchema-instance

0000A0 22 20 78 6D 6C 6E 73 3A 78 73 64 3D 22 68 74 74 " xmlns:xsd="htt

0000B0 70 3A 2F 2F 77 77 77 2E 77 33 2E 6F 72 67 2F 32 p://www.w3.org/2

0000C0 30 30 31 2F 58 4D 4C 53 63 68 65 6D 61 22 3E 3C 001/XMLSchema"><

0000D0 73 6F 61 70 3A 42 6F 64 79 3E 3C 66 6F 6F 20 78 soap:Body><foo x

0000E0 6D 6C 6E 73 3D 22 68 74 74 70 3A 2F 2F 77 77 77 mlns="http://www

0000F0 2E 63 6F 6D 70 61 6E 79 2E 63 6F 6D 2F 73 65 72 .company.com/ser

000100 76 69 63 65 73 2F 45 78 61 6D 70 6C 65 22 3E 3C vices/Example"><

000110 76 61 6C 75 65 73 20 78 6D 6C 6E 73 3A 71 31 3D values xmlns:q1=

000120 22 68 74 74 70 3A 2F 2F 77 77 77 2E 63 6F 6D 70 "http://www.comp

000130 61 6E 79 2E 63 6F 6D 2F 73 65 72 76 69 63 65 73 any.com/services

000140 2F 45 78 61 6D 70 6C 65 22 20 78 73 69 3A 74 79 /Example" xsi:ty

000150 70 65 3D 22 71 31 3A 53 75 62 4F 6E 65 22 20 78 pe="q1:SubOne" x

000160 6D 6C 6E 73 3D 22 22 3E 3C 61 74 74 72 69 62 75 mlns=""><attribu

000170 74 65 4F 6E 65 3E 31 3C 2F 61 74 74 72 69 62 75 teOne>1</attribu

000180 74 65 4F 6E 65 3E 3C 61 74 74 72 69 62 75 74 65 teOne><attribute

000190 54 77 6F 3E 31 30 3C 2F 61 74 74 72 69 62 75 74 Two>10</attribut

0001A0 65 54 77 6F 3E 3C 2F 76 61 6C 75 65 73 3E 3C 2F eTwo></values></

0001B0 66 6F 6F 3E 3C 2F 73 6F 61 70 3A 42 6F 64 79 3E foo></soap:Body>

0001C0 3C 2F 73 6F 61 70 3A 45 6E 76 65 6C 6F 70 65 3E </soap:Envelope>

0001D0

HTTP/1.1 202 Accepted

Date: Wed, 23 Aug 2006 18:01:13 GMT

Server: Microsoft-IIS/6.0

X-Powered-By: ASP.NET

X-AspNet-Version: 1.1.4322

Cache-Control: private

Content-Length: 0

 


 
________________________________

From: Jitendra Kotamraju [mailto:Jitendra.Kotamraju_at_Sun.COM]
Sent: Wed 8/23/2006 1:27 PM
To: dev_at_jax-ws.dev.java.net
Cc: Vivek.Pandey_at_Sun.COM
Subject: Re: Invoking a .NET web service using JAX-WS 2.0



I think the best thing would be to capture http traffic. If you are
using 2.0.1M1, you could do this using a system property as explained here

http://weblogs.java.net/blog/ramapulavarthi/archive/2006/08/monitoring_soap.html

There are also a lot of tools that do this for you.

Jitu

Ryan LeCompte wrote:

> Hello Vivek,
>
> I tried the latest nightly of JAXWS 2.0 RI as you indicated, however
> the problem still remains. The .NET endpoint still doesn't get its
> one-way operation invoked.
>
> I then tried the JAXWS 2.0.1 M1 release as you suggested, however now
> I'm seeing a different problem when I attempt to invoke the one-way
> operation with the JAXWS client.
> The following exception is thrown when the operation is invoked:
>
>
> java.lang.RuntimeException: javax.xml.ws.WebServiceException: No
> Content-Type in the header!
> at com.example.ExampleStub.foo(ExampleStub.java:73)
> I didn't change anything in the .NET 2.0 endpoint implementation.
>
> Please let me know if there is something else you'd like me to try.
>
> Regards,
> Ryan
> *From:* Vivek Pandey [mailto:Vivek.Pandey_at_Sun.COM]
> *Sent:* Tue 8/22/2006 4:32 PM
> *To:* Ryan LeCompte
> *Subject:* Re: Invoking a .NET web service using JAX-WS 2.0
>
> hi Ryan,
>
> I have not got a chance to look at it. But will sure get back to you as
> soon as I see whats going on. Can you try the latest nightly of JAXWS
> 2.0 RI from:
>
> https://jax-ws.dev.java.net/servlets/ProjectDocumentList?folderID=5471&expandFolder=5471&folderID=5471
> <https://jax-ws.dev.java.net/servlets/ProjectDocumentList?folderID=5471&expandFolder=5471&folderID=5471>
>
>
> If it doesn't work you may like to try JAXWS 2.0.1 M1 release we made
> last week. Apart from performance it has fixes to better interoperate
> with .NET 3.0 or Indigo.
>
> thnaks,
> -vivek.
> Ryan LeCompte wrote:
> > (offline)
> >
> > Vivek,
> >
> > Please let me know if there is any particular patch or scenario that
> > you would like me to try. I'm open to any suggestions that you may have.
> > In case I didn't mention it, I'm using JAX-WS 2.0 RI (not the latest
> > milestone that you recently release, but the FCS version), and I've
> > tested this
> > with .NET 1.1 as well as .NET 2.0.
> >
> > Thanks,
> > Ryan
> >
> > ------------------------------------------------------------------------
> > *From:* Ryan LeCompte
> > *Sent:* Tue 8/22/2006 1:17 PM
> > *To:* dev_at_jax-ws.dev.java.net; users_at_jax-ws.dev.java.net
> > *Cc:* dev_at_jax-ws.dev.java.net
> > *Subject:* RE: Re: Invoking a .NET web service using JAX-WS 2.0
> >
> > Hi Vivek,
> >
> > Yes, the problem I'm facing is that the .NET endpoint is not having
> > its operation invoked. Please let me know if I can provide any further
> > information.
> >
> > Thanks,
> > Ryan
> >
> > ------------------------------------------------------------------------
> > *From:* Vivek Pandey [mailto:Vivek.Pandey_at_Sun.COM]
> > *Sent:* Tue 8/22/2006 12:28 PM
> > *To:* users_at_jax-ws.dev.java.net
> > *Cc:* dev_at_jax-ws.dev.java.net
> > *Subject:* Re: Invoking a .NET web service using JAX-WS 2.0
> >
> > Ryan LeCompte wrote:
> > > Hi Vivek,
> > >
> > > Yes, this is a one-way operation. Here is a complete example schema
> > > that illustrates the problem:
> > >
> > As far as nothing happening on the client side is understandable as its
> > one-way and so there is no return value. I guess the problem you're
> > facing is that the .NET endpoint's one-way operation is not invoked, is
> > this right?
> >
> > -vivek.
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <!--
> > > Example WSDL.
> > > -->
> > > <wsdl:definitions name="Example"
> > > targetNamespace="http://www.company.com/services/Example"
> > > xmlns:tns="http://www.company.com/services/Example"
> > > xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> > > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> > > xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> > >
> > > <wsdl:types>
> > > <xsd:schema
> > > targetNamespace="http://www.company.com/services/Example"
> > > xmlns:tns="http://www.company.com/services/Example">
> > > <xsd:complexType name="Base" abstract="true">
> > > <xsd:sequence>
> > > <xsd:element name="attributeOne" type="xsd:int"
> > > minOccurs="1" maxOccurs="1"/>
> > > </xsd:sequence>
> > > </xsd:complexType>
> > > <xsd:complexType name="SubOne">
> > > <xsd:complexContent>
> > > <xsd:extension base="tns:Base">
> > > <xsd:sequence>
> > > <xsd:element name="attributeTwo" type="xsd:int"
> > > minOccurs="1" maxOccurs="1"/>
> > > </xsd:sequence>
> > > </xsd:extension>
> > > </xsd:complexContent>
> > > </xsd:complexType>
> > > <xsd:complexType name="SubTwo">
> > > <xsd:complexContent>
> > > <xsd:extension base="tns:Base">
> > > <xsd:sequence>
> > > <xsd:element name="attributeThree" type="xsd:int"
> > > minOccurs="1" maxOccurs="1"/>
> > > </xsd:sequence>
> > > </xsd:extension>
> > > </xsd:complexContent>
> > >
> > >
> >
> </xsd:complexType>
> > >
> > > <xsd:complexType name="fooRequest">
> > > <xsd:sequence>
> > > <xsd:element name="values" type="tns:Base"
> > > minOccurs="1" maxOccurs="unbounded"/>
> > > </xsd:sequence>
> > >
> > >
> >
> </xsd:complexType>
> > >
> > > <xsd:element name="foo"
> > > type="tns:fooRequest"/>
> > > </xsd:schema>
> > > </wsdl:types>
> > > <wsdl:message name="Example_fooRequest">
> > > <wsdl:part name="parameters" element="tns:foo"/>
> > > </wsdl:message>
> > > <wsdl:portType name="ExamplePortType">
> > > <wsdl:operation name="foo">
> > > <wsdl:input message="tns:Example_fooRequest"/>
> > > </wsdl:operation>
> > > </wsdl:portType>
> > >
> > > <wsdl:binding name="ExampleBinding" type="tns:ExamplePortType">
> > > <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
> > > style="document"/>
> > > <wsdl:operation name="foo">
> > > <soap:operation soapAction="Example/foo"/>
> > > <wsdl:input>
> > > <soap:body use="literal"/>
> > > </wsdl:input>
> > > </wsdl:operation>
> > > </wsdl:binding>
> > > <wsdl:service name="Example">
> > > <wsdl:port name="ExamplePort" binding="tns:ExampleBinding">
> > > <soap:address location="REPLACE_WITH_ACTUAL_URL"/>
> > > </wsdl:port>
> > > </wsdl:service>
> > > </wsdl:definitions>
> > >
> > >
> ------------------------------------------------------------------------
> > > *From:* Vivek Pandey [mailto:Vivek.Pandey_at_Sun.COM]
> > > *Sent:* Tue 8/22/2006 10:59 AM
> > > *To:* users_at_jax-ws.dev.java.net
> > > *Cc:* dev_at_jax-ws.dev.java.net
> > > *Subject:* Re: Invoking a .NET web service using JAX-WS 2.0
> > >
> > > Hi Ryan,
> > >
> > > Looking at the schema types its not obvious what might be going on at
> > > .NET side. Is it possible that this operation is one-way? A complete
> > > WSDL and schema will help see whats going on.
> > >
> > > thnaks,
> > >
> > > -vivek.
> > > Ryan LeCompte wrote:
> > > > Sorry, just one more thing. I should also mention that I was able to
> > > > successfully invoke the same problematic operation on an
> endpoint that
> > > > was built using JWSDP 1.6. So this really seems to be a .NET
> specific
> > > > issue.
> > > >
> > > > Thanks!
> > > >
> > > > Ryan
> > > >
> > > >
> > ------------------------------------------------------------------------
> > > > *From:* Ryan LeCompte
> > > > *Sent:* Tue 8/22/2006 10:24 AM
> > > > *To:* users_at_jax-ws.dev.java.net
> > > > *Cc:* dev_at_jax-ws.dev.java.net
> > > > *Subject:* RE: Re: Invoking a .NET web service using JAX-WS 2.0
> > > >
> > > > Okay, I have some more information from further testing this
> morning.
> > > > I actually used Netbeans 5.5. to auto-generate a web service client
> > > > from the auto-generated .NET WSDL file
> > > > (http://service/service.asmx?WSDL), and I tried invoking various
> > > > methods on it. I was able to invoke one method on the .NET web
> service
> > > > and get a response (which I could do previously), HOWEVER I'm
> not able
> > > > to invoke another operation which looks like the following:
> > > >
> > > > handle(Type)
> > > >
> > > > Where in the WSDL, there are sub-types of Type, such as TypeA, and
> > > > TypeB. I'm actually invoking the service with the JAX-WS client as
> > > > handle(TypeA), however I'm not seeing that operation get invoked on
> > > > the .NET side of the communication. THere are no exceptions/errors
> > > > generated on the JAX-WS 2.0 side, either. Does this mean that JAX-WS
> > > > has problems invoking .NET web services where the complex types are
> > > > polymorphic? JWSDP 1.5/1.6 handled this exact same scenario without
> > > > any trouble. Note that my custom WSDL hasn't changed from when I had
> > > > it working on JWSDP and now trying with JAX-WS.
> > > >
> > > > To be more concrete, here's a WSDL snippet that demonstrates:
> > > >
> > > > <xsd:complexType name="Base" abstract="true">
> > > > <xsd:sequence>
> > > > <xsd:element name="someAttribute" type="xsd:int"
> > > > minOccurs="1" maxOccurs="1"/>
> > > > </xsd:sequence>
> > > > </xsd:complexType>
> > > > <xsd:complexType name="SubA">
> > > > <xsd:complexContent>
> > > > <xsd:extension base="tns:Base">
> > > > <xsd:sequence>
> > > > <xsd:element name="someOtherAttribute"
> > > > type="xsd:string" minOccurs="1"
> > > > maxOccurs="1"/>
> > > > </xsd:sequence>
> > > > </xsd:extension>
> > > > </xsd:complexContent>
> > > > </xsd:complexType>
> > > > <xsd:complexType name="SubB">
> > > > <xsd:complexContent>
> > > > <xsd:extension base="tns:Base">
> > > > <xsd:sequence>
> > > > <xsd:element name="otherAttribute"
> > > > type="xsd:string" minOccurs="0" maxOccurs="1"/>
> > > > </xsd:sequence>
> > > > </xsd:extension>
> > > > </xsd:complexContent>
> > > >
> > > >
> > >
> >
> </xsd:complexType>
> > > >
> > > > <xsd:complexType name="operationRequest">
> > > > <xsd:sequence>
> > > > <xsd:element name="values" type="tns:Base"
> > > > minOccurs="1" maxOccurs="unbounded"/>
> > > > </xsd:sequence>
> > > > </xsd:complexType>
> > > >
> > > > It would be nice to hear if someone else can reproduce this problem,
> > > > or provide a suggestion?
> > > >
> > > > Thanks!
> > > >
> > > > Ryan
> > > >
> > ------------------------------------------------------------------------
> > > > *From:* Ryan LeCompte
> > > > *Sent:* Mon 8/21/2006 8:07 PM
> > > > *To:* users_at_jax-ws.dev.java.net; users_at_jax-ws.dev.java.net
> > > > *Subject:* RE: Re: Invoking a .NET web service using JAX-WS 2.0
> > > >
> > > > Hi Rick,
> > > >
> > > > Thanks for the suggestions. In the past, my approach to web services
> > > > has always been to hand-write a WSDL describing the service, and
> then
> > > > feed this same WSDL into both JWSDP and .NET. This has worked
> superbly
> > > > over the past couple of years. Even though .NET generated its own
> > > > WSDL, the JWSDP (1.6) had no problems communicating with the
> service.
> > > > I'm going to investigate this further tomorrow, but I'm not sure why
> > > > JAX-WS 2.0 used in the same manner would have any trouble.
> > > >
> > > > Ryan
> > > >
> > > >
> > ------------------------------------------------------------------------
> > > > *From:* Rick Jones [mailto:rick_at_activeservice.co.uk]
> > > > *Sent:* Mon 8/21/2006 6:06 PM
> > > > *To:* users_at_jax-ws.dev.java.net
> > > > *Subject:* Re: Invoking a .NET web service using JAX-WS 2.0
> > > >
> > > > My suggestion would be to feed the WSDL generated by .Net into
> > > wsimport to
> > > > generate the client stub code. That way you should guarantee an
> exact
> > > > match. It's the only technique I've ever used to call .Net services,
> > > and I
> > > > haven't run into any problems.
> > > >
> > > > That said I haven't got very far with JAX-WS 2 clients because of
> > > > completely unrelated problems getting it to run in my target
> > > > environment (a
> > > > configurable applet) where 1.x ran fine, so maybe there are gotchas
> > > that I
> > > > haven't hit yet :-/
> > > >
> > > > HTH
> > > >
> > > > Rick Jones
> > > >
> > > > --On 21 August 2006 16:40 -0400 Ryan LeCompte
> > > > <Ryan.LeCompte_at_pangonetworks.com> wrote:
> > > >
> > > > ¦ I just finished converting one of my web services from JWSDP
> 1.6 to
> > > > ¦ JAX-WS 2.0, and I'm running into a bit of a problem. The actual
> > > service
> > > > ¦ implementation is written in .NET, and the client is written using
> > > > ¦ JAX-WS 2.0. The same client used to work fine with JWSDP 1.6,
> > however
> > > > ¦ I'm not seeing service operations go through with JAX-WS 2.0. My
> > > > ¦ question is:
> > > > ¦
> > > > ¦ I know that JAX-WS 2.0 now accesses the WSDL remotely to determine
> > > which
> > > > ¦ operations should be invoked (e.g.,
> > > http://service/myservice.asmx?wsdl).
> > > > ¦ By default, the .NET runtime auto-generates the WSDL at runtime
> > > when you
> > > > ¦ use the ?wsdl extension in the URL. Could this be causing a
> > > problem? The
> > > > ¦ interesting thing is that I don't see any errors on the Java
> > side, and
> > > > ¦ no errors in the log file on the .NET side. The data types
> > > involved are
> > > > ¦ also polymorphic in nature (base type, sub-type, etc). This used
> > > to work
> > > > ¦ fine in JWSDP 1.6. The only problem I can see is that the WSDL
> > used to
> > > > ¦ generated the client (in JAX-WS) is (slightly) different from the
> > > > ¦ auto-generated WSDL when accessed as
> > > http://service/myservice.asmx?wsdl.
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe_at_jax-ws.dev.java.net
> > > > For additional commands, e-mail: users-help_at_jax-ws.dev.java.net
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscribe_at_jax-ws.dev.java.net
> > > For additional commands, e-mail: dev-help_at_jax-ws.dev.java.net
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe_at_jax-ws.dev.java.net
> > For additional commands, e-mail: dev-help_at_jax-ws.dev.java.net
> >
>

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