wood burning stoves 2.0*
The moose likes Web Services and the fly likes SOAP request processing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "SOAP request processing" Watch "SOAP request processing" New topic
Author

SOAP request processing

austin puthur
Greenhorn

Joined: Jul 21, 2004
Posts: 7
Hi,


I have a serious issue...can any body help me out....
<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 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:Body>
<getPricedAvailability xmlns="http://www.openuri.org/" xmlns:tget="http://www.ba.com/schema/tGetPricedAvailabilityV1">
<tget:GetPricedAvailabilityRequest>
<Name>ian</Name>

....i need to add a tag name[in between the two tags] <asl>US </asl>

<age>1234</age>


</tget:GetPricedAvailabilityRequest>
</getPricedAvailability>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope


Can any one suggest or send me the piece of code which does this..

i tried to add the tag by using the below code but in vain it didn't happen ...it is not adding in between the 2 tags.
it is adding after <age>.... Can any one help me in this...Is there is any other way of parsing the SOAP message is possible



SOAPMessageContext smc = (SOAPMessageContext)mc;
SOAPMessage sm = smc.getMessage();
SOAPEnvelope env = sm.getSOAPPart().getEnvelope();
SOAPBody body = env.getBody();

javax.xml.soap.Name sName;
System.out.println(" Entering callEndTag #########################################");
System.out.println("body"+body +" "+"env"+env);

if ( body != null ){
java.util.Iterator childElems = body.getChildElements();
SOAPElement child;
int i=0;
// iterate through child elements
while (childElems.hasNext())
{
System.out.println("childElems" +childElems);

Object elem = childElems.next();

System.out.println("elem" +elem);

if(elem instanceof SOAPElement )
{
// get child element and its name
child = (SOAPElement) elem;

sName = child.getElementName();
if (sName.getLocalName().equals("getPricedAvailability"))
{

childElems = child.getChildElements();
while (childElems.hasNext())
{
// get next child element
elem = childElems.next();
if(elem instanceof SOAPElement )
{

child = (SOAPElement) elem;
sName = child.getElementName();

if (sName.getLocalName().equals("GetPricedAvailabilityRequest"))
{childElems = child.getChildElements();
sName = child.getElementName();

System.out.println("SNAME inSIDE IF LOOP" +sName);

System.out.println("If Elem is a) instance ====After");



if (childElems.hasNext())
{
// get next child element
elem = childElems.next();

System.out.println("If Elem is a) instance == before");

if(elem instanceof SOAPElement )
{


System.out.println("If Elem is a) instance ====After");
System.out.println("before type cast" );
child = (SOAPElement) elem;
sName = child.getElementName();
System.out.println("Start adding process added end date" +sName);



SOAPElement fResponse12 = child.addChildElement(env.createName("EndDate-- ==child "));

fResponse12.addAttribute(env.createName("xmlns"),
"");
fResponse12.addTextNode(strEndDate );
}
}
}
}
}
}
((SOAPMessageContext)mc).setMessage(sm);


AUSTIN
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SOAP request processing
 
Similar Threads
Question regarding MZ notes
Problem with message style web service
Axis rejects int parameter
Adding SOAP elements through DOM
problem with perl web services and java client