Hi,
I am trying to get my head around some of the web services best practices and any limitations that the webMethods toolset inflicts. I have successfully created a web service using a Custom SOAP processor. I had an issue that I worked around, but I want to make sure that I am not limiting myself with this work around solution.
I had an issue using getBody vs. getBodyEntries. I was originally [SIZE=2]using the soap:utils:getbody function. I was taking the output node from that public function and mapping it into the pub:validate function to validate
the node against an XML schema. This resulted in always passing schema validation no matter whether the XML I passed was valid or not. The only way validation failed was if I validated agiang the wM document instead of the wM schema component. I had in the past been told by webMethods support that they recommend validating against the schema component over the wm document, so I logged a ticket telling them that using this getBody service I was unable to validate against the schema.
They evnetually told me that I should be using the getBodyEntries function instead of the getBody function. So I tried that and then was able to validate against the schema successfully (meaning the validate function finally failed if I passed invalid XML).
However the getBodyEntries function ended up creating another issue when mapping its output node into the XMLNodeToDocument function. The document that it created always removed the root element from the document structure that I was trying to convert to. So I opened another ticket and they eventually came back with the following resolution:
[INDENT]When using the output of the getBodyEntries function (bodyEntries) as input to the XMLNodeToDocument function you must map the XMLNodeToDocument output to the root element of the referenced document rather than to the referenced document name. This is a special case for getBodyEntries when using its output as input to the XMLNodeToDocument. If you are using XMLNodeToDocument anywhere else you can map the output document to the high level document name.
[/INDENT]The rep told me that he was going to put a chage request into their support to address this issue, but I am not sure what the outcome will be. What I ended up doing was using getBodyEntries and mapping the index[0] of the output node into XMLNode toDocument function as they suggested and then mapped the output document of that service to the root element of the referenced document that I was converting to. I also mapped the index[0] of the getBodyEntries output node into the validate input object and validated against the wM schema component.
So after all this… Here are my questions:
1. When would you use getBody vs. getBodyEntries in webMethods?
2. When you use getBody does it return the body tags and everything in between?soapenv:Body…</soapenv:Body>
3. When you use getBodyEntries does it return an array of all “xml” nodes which are present in soap:body and excludes the soapenv:body tags?
4. I don’t like assuming that we will always only have one body entry. I am not sure why there would be mulitple body entries, but if it is allowed I do not like that I haven’t accomidated for that scenario. Can you give me an example of why we would pass a SOAP message with multiple body entries?
5. Is it possible to have multiple bodies in a SOAP message? And if so, why would you?
Thanks in advance for your help!
Sara
[/SIZE]
#webMethods#soa#API-Management