Using this xml file for creating soap message:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ord="http://xmlns.oracle.com/communications/ordermanagement">
<soapenv:Header/>
<soapenv:Body>
<ord:UpdateOrder>
<ord:OrderId>26</ord:OrderId>
<ord:View>BroadbandDSLOrderCreation</ord:View>
<ord:UpdatedOrder>
</ord:UpdatedOrder>
</ord:UpdateOrder>
</soapenv:Body>
</soapenv:Envelope>
XML String that need to insert in between UpdatedOrder tags.
<_root>
<DslOrder index="1422888817752">
<SubscriberInfo index="1422888817756">
<Address index="1422888817758">
<City index="1422888817761">OTT</City>
<PostalCode index="1422888817760">101</PostalCode>
<Street index="1422888817759">333</Street>
</Address>
<PhoneNumber index="1422888817762">438</PhoneNumber>
<Name index="1422888817757">xyz</Name>
</SubscriberInfo>
</DslOrder>
</_root>
Output of soap message must be like this:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ord="http://xmlns.oracle.com/communications/ordermanagement">
<soapenv:Header/>
<soapenv:Body>
<ord:UpdateOrder>
<ord:OrderId>26</ord:OrderId>
<ord:View>BroadbandDSLOrderCreation</ord:View>
<ord:UpdatedOrder>
<_root>
<DslOrder index="1422888817752">
<SubscriberInfo index="1422888817756">
<Address index="1422888817758">
<City index="1422888817761">OTT</City>
<PostalCode index="1422888817760">101</PostalCode>
<Street index="1422888817759">333</Street>
</Address>
<PhoneNumber index="1422888817762">438</PhoneNumber>
<Name index="1422888817757">xyz</Name>
</SubscriberInfo>
</DslOrder>
</_root>
</ord:UpdatedOrder>
</ord:UpdateOrder>
</soapenv:Body>
</soapenv:Envelope>
Need to add the XML String to soap envelope.
How can I add that XML string to soap envelope as shown in output?
I am converting xml file to soap message.Now i need to add xml string to soap message (in between same tags). Please help me
You may want to look into using <![CDATA[]]> tags so that the message doesn't try to parse your payload (which happens to be XML).
For example:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ord="http://xmlns.oracle.com/communications/ordermanagement">
<soapenv:Header/>
<soapenv:Body>
<ord:UpdateOrder>
<ord:OrderId>26</ord:OrderId>
<ord:View>BroadbandDSLOrderCreation</ord:View>
<ord:UpdatedOrder>
<![CDATA[
<_root>
<DslOrder index="1422888817752">
<SubscriberInfo index="1422888817756">
<Address index="1422888817758">
<City index="1422888817761">OTT</City>
<PostalCode index="1422888817760">101</PostalCode>
<Street index="1422888817759">333</Street>
</Address>
<PhoneNumber index="1422888817762">438</PhoneNumber>
<Name index="1422888817757">xyz</Name>
</SubscriberInfo>
</DslOrder>
</_root>
]]>
</ord:UpdatedOrder>
</ord:UpdateOrder>
</soapenv:Body>
If you are making the SOAP calls with a Java library, such as jax-ws, the library will take care of this for you (you only have to send the XML payload as is).
Related
I am using SOAPHandler and I need to modify my SOAPMessage in SOAPNHandler:
The message i get:
<soapenv:Envelope xmlns:soapenv="...">
<soapenv:Header/>
<soapenv:Body>
<CC>
<Dat>210520</Dat>
<Tim>1156</Tim>
<MesI>20210000000830</MesI>
<MesT>CC616A</MesT>
<HEA>
<Dec>202105201156</Dec>
</HEA>
</CC>
</soapenv:Body>
</soapenv:Envelope>
I need to add a parent element AA to the body, and get this result:
<soapenv:Envelope xmlns:soapenv="...">
<soapenv:Header/>
<soapenv:Body>
<AA>
<CC>
<Dat>210520</Dat>
<Tim>1156</Tim>
<MesI>20210000000830</MesI>
<MesT>CC616A</MesT>
<HEA>
<Dec>202105201156</Dec>
</HEA>
</CC>
</AA>
</soapenv:Body>
</soapenv:Envelope>
And i can´t figure it out. I hope someone can help me.
Thank you.
Basically I need to read the XML SOAP data which is sent by my client over URL.
I need to use java to read the XML SOAP data and insert the whole XML into data.
A client has given the sample XML format is as below:
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="WebService" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<soapenv:Header/>
<soapenv:Body>
<web:StatusUpdate soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<Order xsi:type="xsd:string">?</Order>
</web:StatusUpdate>
</soapenv:Body>
</soapenv:Envelope>
I need to generate a soap request like the below one :
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Document xmlns:ns2="http://www.xyz" xmlns="thsss.738.syhd.738">
<Customer>
<Group>
<Message>Something</Message>
</Group>
</Customer>
</Document>
But the request getting generated is as below:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://eygyjdg.dbajshb/" xmlns:thss="thsss.738.syhd.738" xmlns:xyz="http://www.xyz">
<soapenv:Header/>
<soapenv:Body>
<Document>
<Customer>
<Group>
<Message>Something</Message>
</Group>
</Customer>
</Document>
</soapenv:Body>
</soapenv:Envelope>
Hence i get a namespace on the "Document" element, is not a valid SOAP version
Can you please tell me how to go about this.
I'm receiving a SOAP request like this, but my service can´t load the values
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns="http://schemas.xmlsoap.org/soap/envelope/"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<soapenv:Header
xmlns="http://schemas.xmlsoap.org/soap/envelope/"/>
<soapenv:Body
xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Operation xmlns="http://www.schema.com/SoS"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
...
But if I remove some of the requests tags, leaving only this
everything works ok:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<soapenv:Header
xmlns="http://schemas.xmlsoap.org/soap/envelope/"/>
<soapenv:Body>
<doOperation
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
...
For an easier reading, I removed xmlns="http://www.schema.com/SoS" from Operation, xmlns="http://schemas.xmlsoap.org/soap/envelope/" from soapenv:Envelope and xmlns="http://schemas.xmlsoap.org/soap/envelope/" from soapenv:Body.
I have web service client and when i send request, the soap message looks like
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<Open xmlns="ttt:some:namespace">
<PartnerName>SomeParther</PartnerName>
<NumberToS>1</NumberToS>
</Open>
</S:Body>
</S:Envelope>
and this incorrect message. The correct message looks like
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="ttt:some:namespace">
<soapenv:Header />
<soapenv:Body>
<ttt:Open>
<ttt:PartnerName>SomeParther</ttt:PartnerName>
<ttt:NumberToS>1</ttt:NumberToS>
</ttt:Open>
</soapenv:Body>
</soapenv:Envelope>
how i do soap request
So_Service soService = new So_Service();
SoPort soPort = soService.getSoaphaSOAP();
/* test */
System.out.println("getServiceName from So_Service" + soService.getServiceName());
soPort.open("SomeParther", 1);
output getServiceName from So_Service ttt:some:namespace
What I'm doing wrong? What should i do for correct generate the message? Please Help
Try the below:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="ttt:some:namespace">
<soapenv:Header />
<soapenv:Body>
<urn:Open>
<urn:PartnerName>SomeParther</urn:PartnerName>
<urn:NumberToS>1</urn:NumberToS>
</urn:Open>
</soapenv:Body>
</soapenv:Envelope>