• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

What's Wrong with this simple WSDL

 
Ranch Hand
Posts: 78
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ranchers,

I have written a contract first web service (its my first TOOO )..... i have deployed the same in glass fish server and when i try to invoke the service using jax-ws generated client im getting this exception
. i also tried creating a soapui project using the same wsdl, but unable to generate the sample request.

Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Cannot find dispatch method for {http://www.example.org/PersonService/}personRequest
at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:111)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107)
at $Proxy29.getPerson(Unknown Source)
at org.example.personservice.PersonServiceTester.main(PersonServiceTester.java:17)


here is my wsdl.....





i think there is some problem with the wsdl. but unable to find it out. can you please help me rancher.........
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
When you try to create a project in soapUI, are there any error messages?
Were you able to successfully create a project with a sample request for the operation of your web service?
I tried to use your WSDL in soapUI and my answers to the above are "yes" and "no".
I'll give you a clue: There are some unnecessary parts in your <binding> element (including child elements).
Upon doubt, I suggest you to look at a WSDL that is known to be good and compare with your WSDL.
Best wishes!
 
Avinash Ga
Ranch Hand
Posts: 78
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ivan...... yes , im also not able to generate a soap request from SoapUI. Thanks for your suggestion. i will try that.

Also ivan im really grateful for your study materials on the certification. Thats really great. im following the same with the one written by Mikalai for my certification. thanks again.
 
Avinash Ga
Ranch Hand
Posts: 78
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ivan,

Finally i resolved the issue . the problem was with my wsdl . the input/output section inside the porttype was not having name attribute. fixed the same .

here is my port type.



Thanks Again.......
 
Avinash Ga
Ranch Hand
Posts: 78
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This time im able to generate the sample request using soapui . but when i submit the request im getting the error

here is my updated (latest) wsdl :-





also here is my soap request :-



and the soap response is :-






can anyone help?

Thanks in advance
 
Bartender
Posts: 1051
5
Hibernate Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your SOAP request is missing the element getPerson which wraps a personRequest.
 
Avinash Ga
Ranch Hand
Posts: 78
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks James. i will try that.
 
Avinash Ga
Ranch Hand
Posts: 78
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi James,

in the wsdl, input message is of the type personRequest and im passing the same from my soap ui. can you please let me know the solution?

Thanks
 
Avinash Ga
Ranch Hand
Posts: 78
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
also if i use this soap message.




im getting.



one more thing..... im a newbie to jax-ws.
 
James Boswell
Bartender
Posts: 1051
5
Hibernate Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Avinash

I think this is progressing. Can you show the java code for your web methods please?
 
Avinash Ga
Ranch Hand
Posts: 78
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi James,

Here is my java code.....

Endpoint Interface.




and here is the service....





one weird thing.....

i published the same web service using EndPoint api and for the request




im getting the response.


its kinda working..... but i dont know why this tag in the response (<ns2:getPersonResponse xmlns:ns2="http://www.example.org/PersonService/">).
atleast it is working if i use EndPoint api to publish.

but the same thing if i deploy in GlassFish server im getting


as a response.

attached is the whole of my (silly) project with ant script. just "ant build" will generate a deployable war. please change the extension of the file to *.zip


Thanks Again
Web-Service.jpg
[Thumbnail for Web-Service.jpg]
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there!

It's been quite a long time since this question has been asked and it still remains without a straightforward solution. Nonetheless, I'm dealing with the very same error you were getting.

The whole hassle is about the attribute "ref". In your code, it's represented in the snippet . by using this attribute in WSDL, the JAX-WS generates the class with its aforementioned attribute annotated with , however, when you try to send this object to the endpoint you get the error

Unmarshalling Error: unexpected element (uri:"....", local:"...."). Expected elements are...

.

First, I'm using CXF to generate the classes, so I tried to upgrade it to a newer version and check if the class attribute was generated correctly (without the annotation). I also tried to use JAX-WS to generate the classes but it turns out all approaches were adding the same annotation config to the field.

After some time analyzing the WSDL which was supposed to generate the domain classes correctly, I realized that if I change the "ref" attribute to "type" and add a "name" attribute with the same property name, the class file got generated correctly.
So in your case, you would have to change the structure of the person element in your WSDL to the following snippet:



I don't know why it gets generated this way and why the same endpoint does not accept the soap message with the namespace in the element, but I know that if you remove the namespace from the element <per:personID>2</per:personID>while you're sending your SOAP message it will work just fine.

It also works if you remove the annotation from the troublesome attribute, but this annotation will be put back again whenever you build your web service classes from the scratch WSDL, so you'd better change the local WSDL either way.

I'm using a third party web service, which I have no idea how it was developed.
 
reply
    Bookmark Topic Watch Topic
  • New Topic