-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate SOAP message example #14
Comments
Please, have a look at the examples: Especially at this one: In order to tweak the message I use Groovy and XmlSlurper. In Java you would have to use XSLT or sth similar. |
Actually, the examples in Java aren't really useful, because they don't show how to set the parameters of the various calls. I'm tempted to go direct and just post XML, but I'd rather use the builder if possible. Are you saying that in the end we have to manipulate the XML in the message directly, before posting the request? |
Yep, that's the case. You have to handle the string - thus I use XmlSlurper. Tom Tom Bujok On Thursday, August 1, 2013 at 11:21 PM, mannyveloso wrote:
|
Sorry to ressurrect this, but I am also trying to get the example to work, and it generates the XML nicely, but I get the same 500 Internal Server Error. If I copy and paste the XML in SoapUI it gets a valid response. |
Just tested with the same service (CurrencyConverter), with the Soap12 binding and it worked from the project. Still doesn't work on Soap(11?) binding though. |
Hi there, this project is really great, been using it for a little while especially for the SoapBuilder. I've got around modifying the contents of the XML using another library I favor for XML manipualtion (jdom). Small question/favor. Would it be possible to include the error message/failure reason when throwing back a TransmissionException (internal error 500) ? The additional details would prevent me from having to parse my log files for the actual cause of the error message. Thank you. |
(this issue is also related to issue #24) In order to avoid XML manipulations (with java it's rather a pain in the a..) to change the message, a good solution would be to have tokens in the message (":var1:", ...) instead of fake content (or '?'), that we could replace later with a simple string seach / replace ... I see that SoapContext has methods to change the content of the input parameters (SoapContext.exampleContent(boolean)), so that would be a good entry point. |
+1 Having the ability to set the parameters in the request builder would be great. I did for now something like: String request = builder.buildInputMessage(operation);
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(
new InputSource(new ByteArrayInputStream(request.getBytes("utf-8"))));
XPath xpath = XPathFactory.newInstance().newXPath();
NodeList nodes = (NodeList)xpath.evaluate(
"//Body/getAllPostedJobs/modifiedSinceDate", doc, XPathConstants.NODESET);
for (int idx = 0; idx < nodes.getLength(); idx++) {
nodes.item(idx).setTextContent(modifiedSinceDate.toString());
}
Transformer xformer = TransformerFactory.newInstance().newTransformer();
StringWriter writer = new StringWriter();
xformer.transform(new DOMSource(doc), new StreamResult(writer));
request = writer.getBuffer().toString(); A lot to do to set one property on the call. |
If you have time, would you be able to add a little more explanation to the "Generate and post a SOAP message" portion of the manual? Here's the request that I generated from the example code:
I have almost no experience with SOAP, so maybe this is obvious, but in this situation how do you specify the FromCurrency and ToCurrency values? It seems like KHR and MDL are picked every time, but I couldn't figure out why or how to change them.
Also, when running the example against http://www.webserviceX.NET/ConversionRate, TransmissionException was being thrown with a message "HTTP response=[Internal Server Error] code=[500]". Maybe there's something wrong with their site?
The text was updated successfully, but these errors were encountered: