Getting raw XML from a webservice request without SOAPHandler - java

I need to get the raw XML from a web service request. Searching in google and stackoverflow I find a solution that seems good:
Getting raw XML response from Java web service client
but my problem is that I don't have the library of the SOAPHandler available. There's something else I can do to achive my purpose without implementing the SOAPHandler? (May be with a more general Handler?)
Thank you.

Related

Save generated Soap XML in database when sending request to remote WS

I'm using CXF to generate classes from WSDL in order for me to consume webservice. I need to save the requests if they fail and I'd like to save the SOAP xml that is sent, together with the exceptino error in my database.
How do I go about doing this? - I've done some searching and looking at the objects at hand while debugging, but nothing seems to give me the SOAP xml.
I didnt post any of my code as my problem isnt a specific coding problem, but more of a "how do I do X.." issue.

How to parse the response SOAP message in Java servlet?

I am working on a SOAP webservice. I am done with sending a SOAP request to get an XML response.
I don't have an idea of parsing the response SOAP message in a servlet or JSP.
Can anyone suggest a solution?
I would strongly recommend that you use something like JAXB to parse the response XML into plain Java objects that are much easier to work with.
In a nutshell, you just need to feed your webservice's WSDL file into JAXB, and it will generate a set of classes appropriate for the service's responses and a parser for handling the response XML.
Here's a brief tutorial if you're using NetBeans: http://netbeans.org/kb/docs/websvc/jaxb.html
Or if you're using Maven:
http://blog.dawouds.com/2008/09/maven-2-wsdl-to-java-using-jaxb.html

Is there a way to get the raw SOAP request from a SOAP based Web Service in a Java application

I am working on an application, that will pass client input to a vendor using web services. As phase I of the project, the vendor provided us with the XSD's and WSDL information. I used apache CXF to build the client jar. Now the issue I am facing is that, as part of the requirement, I need to send them the SOAP Request in an encrypted(I have taken care of the encryption part) XML file, that they will manually process, and send me back the response in another XML file that I need to parse and retrieve the response object.
Is there anyway to use the client jar in a dummy mode or something, where it looks like we are calling the client, but all we are doing is getting the raw SOAP request to a file
I kind of a hit a dead end and I am not totally sure how to proceed here, any help or suggestions would be appreciated
You might try SoapUI, it's a free web service testing tool. I know you can view the raw data of your soap request and response with it. soapUI

Extracting SOAP request from wsdl using wsdl4j

My inputs consist of a WSDL file and an operation name. I need to create a SOAP request and response XML instance after parsing the WSDL. What are my options to implement this? Which parser should I use? I tried wsdl4j. I was able to retrieve the Schema Object. But how do I convert this schema object to a SOAP Request in XML? I was not able to figure that out.
Did you try to use soapUI software ? I always used it in order to validate my manualy written SOAP requests (to a WSLD webservice), but it could give you the target direction
Try membrane SOA SOAP Model library.
Example code:
http://www.membrane-soa.org/create-soap-request.htm
Note: This is not a promotion. Membrane SOA is apache 2.0 licence project and I have no relation with it, except a user. Adding URL is only for helping.

How to match SOAP responses to the schema

Hi I am trying to evaluate a web service. I am using the Axis API to create the requests. I send requests with some attacks, and then want to validate the obtained response to the response schema. I don't have much idea as to how can I achieve this. Can some one help me to achieve this, or give me some pointers that would give me some idea to obtain this.
If you used the wsdl2java tool that comes with Axis2, the response message will be unmarshalled to the generated classes, and you will get an error if the reponse message does not correspond with the classes generated from the WSDL. So in this way you have a kind of implicit validation.
Jens-Martin is correct. If you're using the client generated by Axis wsdl2java, all the validation you need is happening behind the scenes. There are two kinds of validation going on:
SOAP has a schema definition, and the response must be a valid SOAP response or the client will throw an exception.
The WSDL you used to generate the client described what goes in the SOAP envelope of the response. If the response you get doesn't match, the client will throw an exception.
If you really feel compelled to write your own XML parser/validator and SOAP handler, you're on your own.
Try SOAPUI. It is quite a powerful open source testing tool for web services. You can construct test suites, do performance testing, and specify customized validation criteria.

Categories

Resources