Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Change XML format for SOAP messages

LegacyForum
LegacyForum Posts: 1,664 ✭✭
edited December 2016 in SOAtest
Is there a way to change how the XML for a soap message is created? For example, is there a way to change what namespaces are assigned to elements? I know this can be done in Literal View, or Form XML, or even scripted XML, but I am hoping there is a more global method.
When I use Form Input and add a header for WS-Addressing, this is how the xml appears:
CODE
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Header>
 <wsa:MessageID xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing">uuid:f28c2008-b3bf-4c35-9e17-cb47a44591f0</wsa:MessageID>
 <ns1:From xmlns:ns1="http://schemas.xmlsoap.org/ws/2004/03/addressing">
   <ns1:Address>http://machine:9080/servlet/WSACallBackHandler</ns1:Address>

</ns1:From>
 <ns2:ReplyTo xmlns:ns2="http://schemas.xmlsoap.org/ws/2004/03/addressing">
   <ns2:Address>http://machine:9080/servlet/WSACallBackHandler</ns2:Address>

</ns2:ReplyTo>
 <ns3:FaultTo xmlns:ns3="http://schemas.xmlsoap.org/ws/2004/03/addressing">
   <ns3:Address>http://machine:9080/servlet/WSACallBackHandler</ns3:Address>

</ns3:FaultTo>
</SOAP-ENV:Header>

1. I would like to change the gaps in the nodes.
2. Notice that MessageID gets a prefix of WSA and all the others are NSX...this is just inconsistent and hard to follow.
3. I would like to add a global namespace for the addressing headers rather than have each prefix define the namespace.
4. What if I wanted to change the prefix for Envelope from SOAP-ENV just to make sure the server accepts it.
5. Sometimes I want the message XML to be all on 1 line rather than be formatted.

Is there a way to make these types of changes at the application level?
Tagged:

Comments

  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    Unfortunately, there is no way to make such changes at the application level. The only way is through the Literal, Form, and Scripted views which you already know about. Are the things you listed causing issues when testing your web service?
  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    I don't believe they are causing any trouble it was more of a curiosity question. The one thing that does cause some trouble is not being able to easily switch the outgoing message to all 1 line. I believe this is a pending change because in some cases WSE 2.0 SP3 (not sure about version 3) requires no whitespace or returns in the XML as Microsoft's serialization is hokey. This is also the case in some of our web services because we use Serialization directly. I know it doesn't make for very interoperable messaging, but try and tell that to developer's who are on tight schedules. Thanks.

Tagged