• Post Reply Bookmark Topic Watch Topic
  • New Topic

Web Service with Input as XML

 
M Mehta
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am new to webservcies. I created a web services using axis which is exposing a method like

getTrade(String xmlInput, String param1)

where the first parameter should be an XML and second one is a string. However as first parameter is a String, the in WSDL its type is string.

When I call the web service and put in xmlString a simple string (say abc) and param1 also a simple string it works. However if I put in inputXML an XML, it gives me SAX exception as its not able to deserialize the input.

Is there a spefic way to achieve this type of functionality?
 
Matt Middleton
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you calling it? The classes that java generates should convert the < and > to < and > respectively, If you are using SoapUi are some other client where you are pasting the XML text in you'll have to do that before you put the text in. If you aren't, then what did you use to generate the java classes to connect to your service?
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
I am not entirely familiar with Axis, but want to suggest a solution, in case you are out of ideas:
Create (either from scratch or by modifying an existing) a WSDL and use the XML schema type anyType when specifying the parameters of an operation.
Then you use some tool that given the WSDL generates Java classes.
Finally, you can examine the Java classes to see what Java type the XML schema type anyType was mapped to and use that in your web service.
Best wishes!
 
M Mehta
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the replies Matt and Ivan.

I have made some changes in the wsdl and re-generated the web services. I an using Web service explorer in RAD for testing the web services generated. I am able to see the correct request XML being generated now.
However, still getting the following Exception:

org.xml.sax.SAXException: No deserializer for {http://www.w3.org/2001/XMLSchema}anyType

After searching the solution for the problem on google I found that for Complex Types customer deserializers are to be registered. But I don't know how to do that.

Can anyone tell me how to register own deserializers in Axis or point me to a tutorila/example on net?

Thanks,
Me
 
M Mehta
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anybody please tell me how to create a custom deserialzer for web service inputs?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!