Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Unable to send a SOAP request to a service implementing Provider

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have my xsd and wsdl as defined below

Calculator.xsd


Calculator.wsdl


as seen above, I'm using RPC Literal type style.

I ran the xjc against the schema and classes AddRequestType.java AddResponseType.java are created along with ObjectFactory.java and package-info.java

Now my service class is as below


I see an exception is thrown while unmarshalling.


From the code the UnMarshaller is expecting a addRequest and addResponse, but my SOAP request is



Considering the fact that, I started WSDL first approach, can some one guide me, if my WSDL is in fact correct. If yes, what else I'm doing wrong here. I knew that JAXB objects were created based on xsd and the namespace and elements are different, but given a fact that JAXB objects are created separately after WSDL and xsd are designed, what else do I need to make for this to work.

Please advise.
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Could you enclose a copy of an entire SOAP request to your web service? I can recommend using soapUI, both for testing and for seeing entire requests and responses.
The correctness of the request depends on namespace declarations, something left out of your request.
In my electronic book there is an example of how to implement a web service using Provider, as well as a matching client.
The book can be downloaded freely from: http://www.slideshare.net/krizsan/scdjws-5-study-notes-3085287
Best wishes!
 
Rajani Gummadi
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ivan,

From SOAPUI, the SOAP request is



I did not get any response for this, as I believe, due to the run time exception

[com.sun.istack.XMLStreamException2: javax.xml.bind.UnmarshalException: unexpected element (uri:"http://www.example.org/Calculator/", local:"addNumbers"). Expected elements are <{http://www.example.org/Calculator}addRequest>,<{http://www.example.org/Calculator}addResponse>]

But I have not hardcoded the request and response and SOAPUI generated the request based on WSDL. Do I need to fix anything in my WSDL for this to get to work ?
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Take a look at the JAXB bean classes generated by XJC.
XJC does not understand that you are using RPC/Literal, but creates one class for the addRequestType and another for the addResponseType.
These two classes will result in <addRequest> and <addResponse> elements in the request - something that your (RPC) service does not expect.
Best wishes!
 
Well THAT's new! Comfort me, reliable tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic