Parsing SOAP
I tried parsing small Soap envelope using KSOAP2 and KXML2 but unfortunately I got an error my code is as follows:
import java.io.*;
import javax.microedition.midlet.*;
import org.ksoap2.SoapEnvelope;
import org.kxml2.io.KXmlParser;
import org.xmlpull.v1.XmlPullParserException;
import java.io.ByteArrayInputStream;
* @author Welcome
public class MobileSOAPParsingMidlet extends MIDlet {
String msg1="<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"> <S:Header/>" +
" <S:Body> <ns2:Add xmlns:ns2=\"http://webservice/\"> <x>5</x>" +
" <y>8</y> </ns2:Add> </S:Body></S:Envelope>";
String msg2 = " <Envelope Version= \"1\"> <Body> <WebService> <Action>Add</Action> <x>5</x> <y>8</y> </WebService> </Body></Envelope>";
// "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
String msg = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" " +
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n" +
" <getRating xmlns=\"http://tempuri.org\">\n" +
" </getRating>\n" +
" </soap:Body>\n" +
"</soap:Envelope>";
public void startApp() {
byte[] xmlByteArray = msg.getBytes();
ByteArrayInputStream xmlStream = new ByteArrayInputStream( xmlByteArray );
InputStreamReader xmlReader = new InputStreamReader( xmlStream );
KXmlParser parser = new KXmlParser();
try {
parser.setInput(xmlStream, msg);
} catch (XmlPullParserException ex) {
ex.printStackTrace();
SoapEnvelope soapenvelope=new SoapEnvelope(SoapEnvelope.VER12);
try {
soapenvelope.parse(parser);
} catch (IOException ex) {
ex.printStackTrace();
} catch (XmlPullParserException ex) {
ex.printStackTrace();
// catch(UnsupportedEncodingException e){
// System.err.println(e);
public void pauseApp() {
public void destroyApp(boolean unconditional) {
the error is Invalid stream or encoding: java.io.UnsupportedEncodingException: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<getRating xmlns="http://tempuri.org">
</getRating>
</soap:Body>
</soap:Envelope> (position:START_DOCUMENT null@0:0) caused by: java.io.UnsupportedEncodingException: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<getRating xmlns="http://tempuri.org">
</getRating>
</soap:Body>
</soap:Envelope>; nested exception is:
java.io.UnsupportedEncodingException: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<getRating xmlns="http://tempuri.org">
</getRating>
</soap:Body>
</soap:Envelope>
at com.sun.kvem.cldc.i18n.j2me.GenericReader.<init>(GenericReader.java:46)
at com.sun.cldc.i18n.Helper.getStreamReaderPrim(Helper.java:152)
at com.sun.cldc.i18n.Helper.getStreamReader(Helper.java:107)
at java.io.InputStreamReader.<init>(+10)
at org.kxml2.io.KXmlParser.setInput(+563)
at MobileSOAPParsingMidlet.startApp(MobileSOAPParsingMidlet.java:38)
at javax.microedition.midlet.MIDletProxy.startApp(MIDletProxy.java:43)
at com.sun.midp.midlet.Scheduler.schedule(Scheduler.java:374)
at com.sun.midp.main.Main.runLocalClass(Main.java:466)
at com.sun.midp.main.Main.main(Main.java:120)
org.xmlpull.v1.XmlPullParserException: No Input specified (position:START_DOCUMENT null@0:0)
at org.kxml2.io.KXmlParser.exception(+47)
at org.kxml2.io.KXmlParser.nextImpl(+13)
at org.kxml2.io.KXmlParser.next(+23)
at org.kxml2.io.KXmlParser.nextTag(+4)
at org.ksoap2.SoapEnvelope.parse(+6)
at MobileSOAPParsingMidlet.startApp(MobileSOAPParsingMidlet.java:44)
at javax.microedition.midlet.MIDletProxy.startApp(MIDletProxy.java:43)
at com.sun.midp.midlet.Scheduler.schedule(Scheduler.java:374)
at com.sun.midp.main.Main.runLocalClass(Main.java:466)
at com.sun.midp.main.Main.main(Main.java:120
I am currently replacing my Oracle software with a newer version and therefor without a database so I can't give you a proper example, BUT to give you a hint, you leftout the namespace references in EXTRACT and EXTRACTVALUE. It could be that you need multiple namespace declarations, but I can't check it now to give you the proper example. It should be something along the lines like the following.
SELECT EXTRACT(a.col1,'//Response/Result/text()', 'xmlns="http://myhost/myhostcomm"').getStringVal() "Ext",
EXTRACTVALUE(a.col1,'//Response/@Result','xmlns="http://myhost/myhostcomm"') "ExtVal"
FROM XML_test a
/ DO NOT USE //, it will cost you dearly regarding performance, BE PRECISE...!
Similar Messages
-
"Error while parsing SOAP XML payload: no element found" received when invoking Web Service
Running PB 12.1 Build 7000. Using Easysoap. Error ""Error while parsing SOAP XML payload: no element found" received when invoking Web Service". This error does not appear to be coming from the application code. Noticed that there were some erroneous characters showing up within the header portion of the XML ("&Quot;"). Not sure where these are coming from. When I do a find within the PB code for """" it gets located within two objects, whereas they both reference a "temp_xml_letter". Not sure where or what temp_xml_letter resides??? The developer of this is no longer with us and my exposure to WSDL and Web Services is rather limited. Need to get this resolved...please.
This is the result of the search. Notice the extraneous characters ("""):
dar1main.pbl(d_as400_mq_xml)
darlettr.pbl(d_email_xml)
---------- Search: Searching Target darwin for 'temp_xml' (9:52:41 AM)
---------- 2 Matches Found On "temp_xml":
dar1main.pbl(d_as400_mq_xml).d_as400_mq_xml: export.xml(usetemplate="temp_xml_letter" headgroups="1" includewhitespace="0" metadatatype=0 savemetadata=0 template=(comment="" encoding="UTF-8" name="temp_xml_letter" xml="<?xml version=~"1.0~" encoding=~"UTF-16LE~" standalone=~"yes~"?><EmailServiceTransaction xmlns=~"http://xml.xxnamespace.com/Utility/Email/EmailService" ~" xmlns:imc=~"http://xml.xxnamespace.com/IMC~" xmlns:xsi=~"http://www.w3.org/2001/XMLSchema-instance~" xmlns:root=~"http://xml.xxnamespace.com/RootTypes~" xmlns:email=~"http://xml.xxnamespace.com/Utility/Email~" xsi:schemaLocation=~"http://xml.xxnamespace.com/Utility/Email/EmailService http://dev.xxnamespace.com/Utility/Email/EmailService/V10-TRX-EmailService.xsd~"><EmailServiceInformation><EmailServiceDetail __pbband=~"detail~"><ApplicationIdentifier> applicationidentifier </ApplicationIdentifier><AddresseeInformation><AddresseeDetail><Number> number </Number></AddresseeDetail></AddresseeInformation><EmailMessageInformation><Ema
darlettr.pbl(d_email_xml).d_email_xml: export.xml(usetemplate="temp_xml_letter" headgroups="1" includewhitespace="0" metadatatype=0 savemetadata=0 template=(comment="" encoding="UTF-8" name="temp_xml_letter" xml="<?xml version=~"1.0~" encoding=~"UTF-16LE~" standalone=~"yes~"?><EmailServiceTransaction xmlns=~"http://xml.xxnamespace.com/Utility/Email/EmailService" ~" xmlns:imc=~"http://xml.xxnamespace.com/IMC~" xmlns:xsi=~"http://www.w3.org/2001/XMLSchema-instance~" xmlns:root=~"http://xml.xxnamespace.com/RootTypes~" xmlns:email=~"http://xml.xxnamespace.com/Utility/Email~" xsi:schemaLocation=~"http://xml.xxnamespace.com/Utility/Email/EmailService http://dev.xxnamespace.com/Utility/Email/EmailService/V10-TRX-EmailService.xsd~"><EmailServiceInformation><EmailServiceDetail __pbband=~"detail~"><ApplicationIdentifier> applicationidentifier </ApplicationIdentifier><AddresseeInformation><AddresseeDetail><Number> imcnumber </Number></AddresseeDetail></AddresseeInformation><EmailMessageInformation><Ema
---------- Done 2 Matches Found On "temp_xml":
---------- Finished Searching Target darwin for 'temp_xml' (9:52:41 AM)Maybe "extraneous" is an incorrect term. Apparantly, based upon the writeup within Wiki, the parser I am using does not interpret the """? How do I find which parser is being utilized and how to control it?
<<<
If the document is read by an XML parser that does not or cannot read external entities, then only the five built-in XML character entities (see above) can safely be used, although other entities may be used if they are declared in the internal DTD subset.
If the document is read by an XML parser that does read external entities, then the five built-in XML character entities can safely be used. The other 248 HTML character entities can be used as long as the XHTML DTD is accessible to the parser at the time the document is read. Other entities may also be used if they are declared in the internal DTD subset.
>>> -
Hi,
I would like to know how efficient would be to use Oracle Text to parse SOAP messages. The body of the SOAP messages are heterogeneous in terms of format and size (smallest messages is about 20 lines, biggest message is about 200 lines). The number of records to parse is approximately one hundred thousand every hour.
Thank you.In what sense do you want to "parse" them? Do you just want to find individual strings in the SOAP messages, or are you looking to fully interpret the meaning and content of the SOAP messages? If it's the second of these, then Oracle Text is not the right solution - you could perhaps look at Oracle XML Database instead.
-
Parsing SOAP Results into Variables
Can someone assist me in figuring out what way I need to go
to parse SOAP results into an array?
I have setup the <MX:WEBService> correctly, created my
resultEvent(event) handler and faultEvenet(event) handler as
needed. Below is the web service:
<mx:WebService
id="srvGetTagHistory" wsdl="{SOAP_URL}"
result="CreateTagHistory(event)" fault="faultEvenet(event)"
useProxy="false">
<mx:operation name="GetTagHistory" resultFormat="e4x">
<mx:request>
<RSWID>{vRSWID}</RSWID>
</mx:request>
</mx:operation>
</mx:WebService>
This works perfectly. I can return the results of the
webservice to a text area control, and the complete SOAP results
are displayed.
My problem is I cannot and have not figured out how to make
the SOAP results into some type of arraycollection for using in,
lets say, a dataGrid.
Here is an example of a SOAP result for the above webservice:
<NS1:GetTagHistoryResponse
xmlns:NS1="urn:myresaleworldserviceIntf-myresaleworldserver"
xmlns:NS2="urn:myresaleworldserviceIntf" 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"
xmlns:SOAP-ENC="
http://schemas.xmlsoap.org/soap/encoding/">
<NS2:return href="#1"/>
<SOAP-ENC:Array id="1">
<item href="#2"/>
<item href="#9"/>
<item href="#16"/>
<item href="#25"/>
<item href="#29"/>
</SOAP-ENC:Array>
<NS2:rswTagHistory id="2">
<OrderDate>2005-12-08T11:15:24.857-05:00</OrderDate>
<TagType>CB Tags</TagType>
<NS2:ColorDetail href="#3"/>
</NS2:rswTagHistory>
<SOAP-ENC:Array id="3">
<item href="#4"/>
<item href="#5"/>
<item href="#6"/>
<item href="#7"/>
<item href="#8"/>
</SOAP-ENC:Array>
<NS2:rswTagColorDetail id="4">
<TagColor>Lavender</TagColor>
<Total>2</Total>
</NS2:rswTagColorDetail>
<NS2:rswTagColorDetail id="5">
<TagColor>Light Blue</TagColor>
<Total>2</Total>
</NS2:rswTagColorDetail>
<NS2:rswTagColorDetail id="6">
<TagColor>Green</TagColor>
<Total>2</Total>
</NS2:rswTagColorDetail>
<NS2:rswTagColorDetail id="7">
<TagColor>Pink</TagColor>
<Total>2</Total>
</NS2:rswTagColorDetail>
<NS2:rswTagColorDetail id="8">
<TagColor>Yellow</TagColor>
<Total>1</Total>
</NS2:rswTagColorDetail>
<NS2:rswTagHistory id="9">
<OrderDate>2005-12-08T11:18:44.233-05:00</OrderDate>
<TagType>CB Tags</TagType>
<NS2:ColorDetail href="#10"/>
</NS2:rswTagHistory>
<SOAP-ENC:Array id="10">
<item href="#11"/>
<item href="#12"/>
<item href="#13"/>
<item href="#14"/>
<item href="#15"/>
</SOAP-ENC:Array>
<NS2:rswTagColorDetail id="11">
<TagColor>Lavender</TagColor>
<Total>2</Total>
</NS2:rswTagColorDetail>
<NS2:rswTagColorDetail id="12">
<TagColor>Light Blue</TagColor>
<Total>3</Total>
</NS2:rswTagColorDetail>
<NS2:rswTagColorDetail id="13">
<TagColor>Green</TagColor>
<Total>2</Total>
</NS2:rswTagColorDetail>
<NS2:rswTagColorDetail id="14">
<TagColor>Pink</TagColor>
<Total>3</Total>
</NS2:rswTagColorDetail>
<NS2:rswTagColorDetail id="15">
<TagColor>Yellow</TagColor>
<Total>2</Total>
</NS2:rswTagColorDetail>
<NS2:rswTagHistory id="16">
<OrderDate>2006-08-07T13:56:22.513-05:00</OrderDate>
<TagType>CB Tags</TagType>
<NS2:ColorDetail href="#17"/>
</NS2:rswTagHistory>
<SOAP-ENC:Array id="17">
<item href="#18"/>
<item href="#19"/>
<item href="#20"/>
<item href="#21"/>
<item href="#22"/>
<item href="#23"/>
<item href="#24"/>
</SOAP-ENC:Array>
<NS2:rswTagColorDetail id="18">
<TagColor>Lavender</TagColor>
<Total>2</Total>
</NS2:rswTagColorDetail>
<NS2:rswTagColorDetail id="19">
<TagColor>Light Blue</TagColor>
<Total>2</Total>
</NS2:rswTagColorDetail>
<NS2:rswTagColorDetail id="20">
<TagColor>Green</TagColor>
<Total>2</Total>
</NS2:rswTagColorDetail>
<NS2:rswTagColorDetail id="21">
<TagColor>Orange</TagColor>
<Total>2</Total>
</NS2:rswTagColorDetail>
<NS2:rswTagColorDetail id="22">
<TagColor>Pink</TagColor>
<Total>1</Total>
</NS2:rswTagColorDetail>
<NS2:rswTagColorDetail id="23">
<TagColor>Red</TagColor>
<Total>2</Total>
</NS2:rswTagColorDetail>
<NS2:rswTagColorDetail id="24">
<TagColor>Yellow</TagColor>
<Total>1</Total>
</NS2:rswTagColorDetail>
<NS2:rswTagHistory id="25">
<OrderDate>2007-04-10T12:08:03.950-05:00</OrderDate>
<TagType>CB Tags</TagType>
<NS2:ColorDetail href="#26"/>
</NS2:rswTagHistory>
<SOAP-ENC:Array id="26">
<item href="#27"/>
<item href="#28"/>
</SOAP-ENC:Array>
<NS2:rswTagColorDetail id="27">
<TagColor>Light Blue</TagColor>
<Total>3</Total>
</NS2:rswTagColorDetail>
<NS2:rswTagColorDetail id="28">
<TagColor>Green</TagColor>
<Total>1</Total>
</NS2:rswTagColorDetail>
<NS2:rswTagHistory id="29">
<OrderDate>2007-12-19T12:52:30.883-05:00</OrderDate>
<TagType>Thermal Tags</TagType>
<NS2:ColorDetail href="#30"/>
</NS2:rswTagHistory>
<SOAP-ENC:Array id="30"/>
</NS1:GetTagHistoryResponse>
Any assistance to this issue would be greatly appreciated.If you have set resultFormat="e4x" than you can handle the
result very easily.
I guess you already find out that your result is in
event.result.
Your example is too hard to parse by human.
You can read:
http://livedocs.adobe.com/labs/flex3/html/help.html?content=13_Working_with_XML_01.html
Especially: Traversing XML structures and Using XML
namespaces
I hope this will help -
Parsing Soap Message Exception
In my environment, flex looks like unable to parse soap
message if MTOM and SWA of my web services were enabled. Can anyone
help me?Which version of Flexbuilder are you using? FB2.01 just
support SOAP 1.1,or am I wrong?
What exactly do you mean with SWA (seems not to be any
offical shortterm of w3c)?
best regards
kcell -
Java WSDP 1.4 is not parsing SOAP Exceptions
We used Java WSDP 1.4 toolkit to generate stubs for webservices. We used Tomcat 5.1 as the web container. When methods of the webservice are invoked which do not return SOAP exception responses, WSDP is able to properly parse the response and display the resutls correctly. But when the responses contains SOAP exceptions, WSDP always returns
"java.rmi.RemoteException: Runtime exception; nested exception is: trailing block elements must have an id attribute".
But other toolkits like Axis 1.1,.Net,ColdFusionMX,Glue are returning proper exceptions messages. The following is the exception message received from the other toolkits for the same method invocation.
"Exception has been thrown by the target of an invocation. '1000:Invalid data source name 'invalid_String'"
Apart from Java WSDP all the other toolkits that we mentioned are able to parse the exception message properly and display the same.
Any ideas why the toolkit is behaving like this. All the versions of Java WSDP that have come till date have a similar problem. We would be happy to hear any responses for the problem the we are facing in Java WSDP 1.4. At present we have decided not to use the toolkit for any web service development.Am specifying the URL of the WSDL file for which we are unable to get proper SOAP Exceptions, whenever they are generated. Whenever we give valid values while invoking the methods, the response is properly parsed, but when a SOAP Exception is supposed to be generated, it generally returns the Runtime exception that we mentioned. Can you please look into it and identify the reason about why it is failing. In case you are able to run it through properly, please attach the code that would make it work properly.
The URL is :
http://arcweb.esri.com/services/v2/PlaceFinderSample.wsdl -
Using DOM to parse SOAP fault doesn't work properly
why, when I run the following:
import java.io.IOException;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class ParseFaultDom {
public void operation(String uri) {
System.out.println("Parsing XML File: " + uri + "\n\n");
String faultCode = "";
String faultString = "";
try {
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(uri);
// should only be one apiece here
NodeList faultCodes = document.getElementsByTagName("faultcode");
NodeList faultStrings=document.getElementsByTagName("faultstring");
Node codeNode = faultCodes.item(0);
Node stringsNode = faultStrings.item(0);
faultCode = codeNode.getNodeValue();
faultString = stringsNode.getNodeValue();
System.out.println("code: " + faultCode);
System.out.println("string: " + faultString);
} catch(ParserConfigurationException e) {
System.out.println("Error creating parser: " + e.getMessage( ));
} catch(IOException e) {
System.out.println("Error reading URI: " + e.getMessage( ));
} catch (SAXException e) {
System.out.println("Error in parsing: " + e.getMessage( ));
public static void main(String[] args) {
if (args.length != 1) {
System.out.println("Usage: java ParseFault [XML URI]");
System.exit(0);
String uri = args[0];
ParseFaultDom pfd = new ParseFaultDom();
pfd.operation(uri);
giving it the following xml file as input:
<?xml version='1.0' encoding='UTF-8'?>
<s:Envelope xmlns:s="http://www.w3.org/2001/06/soap-envelope/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<s:Body>
<s:Fault>
<faultcode xsi:type="xsd:string">Client</faultcode>
<faultstring xsi:type="xsd:string">
Invalid value given for identifier field: "-1".
</faultstring>
<details>
<a>a</a>
<b>b</b>
<c>c</c>
</details>
</s:Fault>
</s:Body>
</s:Envelope>
do I get the following output:
Parsing XML File: fault.xml
code: null
string: null
In other words, it finds the tags I'm looking for, but it isn't getting the tag value, apparently.... I can add more instances of each tag, or delete them altogether, and the program raises the appropriate errors.... so it's is finding the tags inside the file, it just apparently doesn't pick up the value for some reason....
thanks anyone who can help... this should be simple, but it doesn't want to work for me... bad karma?First of all, thanks a million for posting replies to my first two posts on these forums, you don't realize how much you have helped me. I feel bad for not assigning duke dollars so you could get them, so I owe you a few :)
Anyway, I see what was going on now, my thinking was at first that a Node consisted of a tag and it's value, and now I see that those are each a distinct Node element. So now I see that the enclosed text is itself a separate Node object, so I needed to get the child node of codeNode and then call getNodeValue on it to get the text I was looking for... ah, the life of a programmer...
anyway, thanks again!!! -
Receiver SOAP : Parsing SOAP Exception
Hello
We have a simple scenario SOAP scenario and we are calling backend service in our Receiver SOAP
It seems that issue is with the SOAP Action.
Our backend service has multiple SOAP Actions :
Endpoint is as follows
http://serverID/ABCSoftware/ABCdataexchange.asmx
The SOAP Action is given as follows
http://ABCSoftware.net/SOAPAction
We are getting the following error
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <!-- Inbound Message
-->
- <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
<SAP:Category>XIAdapter</SAP:Category>
<SAP:Code area="PARSING">ADAPTER.SOAP_EXCEPTION</SAP:Code>
<SAP:P1 />
<SAP:P2 />
<SAP:P3 />
<SAP:P4 />
<SAP:AdditionalText>soap fault: System.Web.Services.Protocols.SoapException: Server was unable to read request. ---> System.InvalidOperationException: There is an error in XML document (1, 266). ---> System.FormatException: Input string was not in a correct format. at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at System.Xml.XmlConvert.ToInt32(String s) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read40_Item(Boolean isNullable, Boolean checkType) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read141_AllocatedResourceDetails() at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer172.Deserialize(XmlSerializationReader reader) at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) --- End of inner exception stack trace --- at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle) at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters() --- End of inner exception stack trace --- at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters() at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()</SAP:AdditionalText>
<SAP:Stack />
<SAP:Retry>M</SAP:Retry>
</SAP:Error>
We appreciate your assistance with the issue.
Thanks.
KiranHi Kiran
As you have multiple SOAP action. WSDL can have only one and can be used per communication channel.
Looking at your error its a XML serialization issue - exception with parser. Your XML input is not correct. If changes are made in your system / target system for the WSDL used. Reimport corrected one and try again
Thanks
Gaurav -
Error when parsing SOAP message from JSP
i write a class to call SOAP message from a servlet on jdev 1013
when i run the class alone it works fine
soapMessage = this.buildSOAPMessagee();
ByteArrayOutputStream output = new ByteArrayOutputStream();
soapMessage.writeTo(output);
SOAPConnectionFactory connf = SOAPConnectionFactory.newInstance();
SOAPConnection conn = connf.createConnection();
SOAPMessage smsg= conn.callsoapMessage, "http://190.0.0.16:8988/mmsc/httpReceiver");
smsg.writeTo(out);
but when running same class same method from jsp page...i have Exception
javax.xml.soap.SOAPException: Unable to get header stream in saveChanges at oracle.j2ee.ws.saaj.soap.MessageImpl.saveChangesMimeEncoded(MessageImpl.java:576) at oracle.j2ee.ws.saaj.soap.MessageImpl.saveChanges(MessageImpl.java:622) at oracle.j2ee.ws.saaj.soap.MessageImpl.saveChanges(MessageImpl.java:686) at oracle.j2ee.ws.saaj.soap.MessageImpl.writeTo(MessageImpl.java:702) at test.test2.ret(test2.java:341) at untitled1.jspService(_untitled1.java:45) [untitled1.jsp] at com.orionserver[Oracle Containers for J2EE 10g (10.1.3.0.0) ].http.OrionHttpJspPage.service(OrionHttpJspPage.java:60) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:416) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:478) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:401) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:719) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:119) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112) at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260) at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:230) at oracle.oc4j.network.ServerSocketAcceptHandler.access$800(ServerSocketAcceptHandler.java:33) at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:831) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298) at java.lang.Thread.run(Thread.java:595)Caused by: java.io.IOException: SOAP exception while trying to externalize: Error parsing envelope: (1, 1) Start of root element expected. at oracle.j2ee.ws.saaj.soap.SOAPPartImpl.getContentAsStream(SOAPPartImpl.java:220) at oracle.j2ee.ws.saaj.soap.MessageImpl.getHeaderBytes(MessageImpl.java:522) at oracle.j2ee.ws.saaj.soap.MessageImpl.saveChangesMimeEncoded(MessageImpl.java:574) ... 23 moreCaused by: javax.xml.soap.SOAPException: Error parsing envelope: (1, 1) Start of root element expected. at oracle.j2ee.ws.saaj.soap.soap11.SOAPImplementation11.createEnvelope(SOAPImplementation11.java:104) at oracle.j2ee.ws.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:76) at oracle.j2ee.ws.saaj.soap.SOAPPartImpl.getContentAsStream(SOAPPartImpl.java:215) ... 25 moreCaused by: oracle.xml.parser.v2.XMLParseException: Start of root element expected. at oracle.xml.parser.v2.XMLError.flushErrors1(XMLError.java:320) at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:333) at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:295) at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:201) at oracle.j2ee.ws.saaj.soap.soap11.SOAPImplementation11.createEnvelope(SOAPImplementation11.java:78) ... 27 more
dose anybody can help why that happend when running the code from JSPi write a class to call SOAP message from a servlet on jdev 1013
when i run the class alone it works fine
soapMessage = this.buildSOAPMessagee();
ByteArrayOutputStream output = new ByteArrayOutputStream();
soapMessage.writeTo(output);
SOAPConnectionFactory connf = SOAPConnectionFactory.newInstance();
SOAPConnection conn = connf.createConnection();
SOAPMessage smsg= conn.callsoapMessage, "http://190.0.0.16:8988/mmsc/httpReceiver");
smsg.writeTo(out);
but when running same class same method from jsp page...i have Exception
javax.xml.soap.SOAPException: Unable to get header stream in saveChanges at oracle.j2ee.ws.saaj.soap.MessageImpl.saveChangesMimeEncoded(MessageImpl.java:576) at oracle.j2ee.ws.saaj.soap.MessageImpl.saveChanges(MessageImpl.java:622) at oracle.j2ee.ws.saaj.soap.MessageImpl.saveChanges(MessageImpl.java:686) at oracle.j2ee.ws.saaj.soap.MessageImpl.writeTo(MessageImpl.java:702) at test.test2.ret(test2.java:341) at untitled1.jspService(_untitled1.java:45) [untitled1.jsp] at com.orionserver[Oracle Containers for J2EE 10g (10.1.3.0.0) ].http.OrionHttpJspPage.service(OrionHttpJspPage.java:60) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:416) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:478) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:401) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:719) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:119) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112) at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260) at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:230) at oracle.oc4j.network.ServerSocketAcceptHandler.access$800(ServerSocketAcceptHandler.java:33) at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:831) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298) at java.lang.Thread.run(Thread.java:595)Caused by: java.io.IOException: SOAP exception while trying to externalize: Error parsing envelope: (1, 1) Start of root element expected. at oracle.j2ee.ws.saaj.soap.SOAPPartImpl.getContentAsStream(SOAPPartImpl.java:220) at oracle.j2ee.ws.saaj.soap.MessageImpl.getHeaderBytes(MessageImpl.java:522) at oracle.j2ee.ws.saaj.soap.MessageImpl.saveChangesMimeEncoded(MessageImpl.java:574) ... 23 moreCaused by: javax.xml.soap.SOAPException: Error parsing envelope: (1, 1) Start of root element expected. at oracle.j2ee.ws.saaj.soap.soap11.SOAPImplementation11.createEnvelope(SOAPImplementation11.java:104) at oracle.j2ee.ws.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:76) at oracle.j2ee.ws.saaj.soap.SOAPPartImpl.getContentAsStream(SOAPPartImpl.java:215) ... 25 moreCaused by: oracle.xml.parser.v2.XMLParseException: Start of root element expected. at oracle.xml.parser.v2.XMLError.flushErrors1(XMLError.java:320) at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:333) at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:295) at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:201) at oracle.j2ee.ws.saaj.soap.soap11.SOAPImplementation11.createEnvelope(SOAPImplementation11.java:78) ... 27 more
dose anybody can help why that happend when running the code from JSP -
How to parse SOAP XML output and load to oracle9i table
Below is the SOAP output response and I need to load the data into oracle 9i database tables.
I am able to parse regular XML without namespaces but unable to parse the data with namespaces.
I would need help in parsing this XML.
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<u:Timestamp u:Id="_0">
<u:Created>2011-11-04T23:16:08.437Z</u:Created>
<u:Expires>2011-11-04T23:21:08.437Z</u:Expires>
</u:Timestamp>
</o:Security>
</s:Header>
<s:Body>
<AssetGetListResponse xmlns="http://dev.services.xerox.com">
<AssetGetListResult xmlns:a="http://schemas.datacontract.org/2004/07/Xerox.MPS" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:AssetFeed>
<a:AccountID>de5862bf-f223-e011-bd3b-0024e861b15c</a:AccountID>
<a:AccountName>MPS-API Sandbox</a:AccountName>
<a:AssetID>ecf1545a-f1e9-e011-8a8a-0024e861b15c</a:AssetID>
<a:AssetNumber>57119B28</a:AssetNumber>
<a:AssetTag3rdParty i:nil="true"/>
<a:ChargebackCodeID>1a5962bf-f223-e011-bd3b-0024e861b15c</a:ChargebackCodeID>
<a:ContractNumber i:nil="true"/>
<a:ContractTypeDescription i:nil="true"/>
<a:ControlID i:nil="true"/>
<a:Group i:nil="true"/>
<a:GroupID i:nil="true"/>
<a:InScope>false</a:InScope>
<a:MACAddress>0000AA713E97</a:MACAddress>
<a:Manufacturer>Xerox</a:Manufacturer>
<a:Model>WorkCentre Pro 265</a:Model>
<a:ModifiedDate>2011-11-02T16:52:12.947Z</a:ModifiedDate>
<a:PricePlanID>c25a62bf-f223-e011-bd3b-0024e861b15c</a:PricePlanID>
<a:SerialNumber>UTU101993N</a:SerialNumber>
<a:VersionNumber>634558495329470000</a:VersionNumber>
</a:AssetFeed>
<a:AssetFeed>
<a:AccountID>de5862bf-f223-e011-bd3b-0024e861b15c</a:AccountID>
<a:AccountName>MPS-API Sandbox</a:AccountName>
<a:AssetID>b33b5160-f1e9-e011-8a8a-0024e861b15c</a:AssetID>
<a:AssetNumber>7EE42ADC</a:AssetNumber>
<a:AssetTag3rdParty i:nil="true"/>
<a:ChargebackCodeID>1a5962bf-f223-e011-bd3b-0024e861b15c</a:ChargebackCodeID>
<a:ContractNumber i:nil="true"/>
<a:ContractTypeDescription i:nil="true"/>
<a:ControlID i:nil="true"/>
<a:Group i:nil="true"/>
<a:GroupID i:nil="true"/>
<a:InScope>false</a:InScope>
<a:MACAddress>0800379B4C2A</a:MACAddress>
<a:Manufacturer>Xerox</a:Manufacturer>
<a:Model>WorkCentre 7428</a:Model>
<a:ModifiedDate>2011-11-02T16:52:14.383Z</a:ModifiedDate>
<a:PricePlanID>c25a62bf-f223-e011-bd3b-0024e861b15c</a:PricePlanID>
<a:SerialNumber>PBB015012</a:SerialNumber>
<a:VersionNumber>634558495343830000</a:VersionNumber>
</a:AssetFeed>
</AssetGetListResult>
</AssetGetListResponse>
</s:Body>
</s:Envelope>
This is what I tried.
declare
lp_parser xmlParser.Parser;
lx_xmldoc xmlDom.DOMDocument;
ln_doc_node xmlDom.DOMNode;
lnl_product xmlDom.DOMNodeList;
lnl_meter xmlDom.DOMNodeList;
ln_product xmlDom.DOMNode;
ln_meter xmlDom.DOMNode;
li_product_cnt NUMBER;
li_product_max NUMBER;
li_meter_cnt NUMBER;
li_meter_max NUMBER;
lnl_asset_meter_nodes xmldom.DOMNodeList;
ln_asset_meter_node xmldom.DOMNode;
ls_batch_number VARCHAR2(30);
ldt_proc_dt DATE;
ls_batch_item VARCHAR2(30);
ls_place_id place.place_id%TYPE;
ls_product_id product.product_id%TYPE := ' ';
ls_contract_id contract.contract_id%TYPE;
li_contract_version contract.contract_version%TYPE;
li_contract_sequence contr_product.sequence%TYPE;
ls_meter_id meter_log.meter_id%TYPE;
ls_read_type meter_log.read_type%TYPE;
ldt_reading_dt meter_log.reading_dt%TYPE;
li_meter_value meter_log.meter_value%TYPE;
li_adjust_copies meter_log.meter_value%TYPE;
ls_meter_type VARCHAR2(20);
ls_serial_id product.serial_id%TYPE;
ls_meter_read_type VARCHAR2(50);
invalid_parsing EXCEPTION;
PRAGMA EXCEPTION_INIT(invalid_parsing, -20100);
BEGIN
FOR meter_xml_rec IN (SELECT SOAP_RESPONSE
FROM temp_table
WHERE call_id=2) LOOP
lp_parser := xmlparser.newParser;
xmlparser.parseClob(lp_parser, meter_xml_rec.SOAP_RESPONSE);
lx_xmldoc := xmlparser.getDocument(lp_parser);
xmlparser.freeParser(lp_parser);
ln_doc_node := xmlDom.makeNode(lx_xmldoc);
ls_batch_number := xslProcessor.valueOf(ln_doc_node, 'AssetGetListResponse/AssetGetListResult/AssetFeed/AccountID');
lnl_product := xslprocessor.selectNodes(ln_doc_node, 'AssetGetListResponse/AssetGetListResult/a:AssetFeed');
li_product_max := xmlDom.getLength(lnl_product)-1;
FOR li_product_cnt IN 0..li_product_max LOOP
ln_product := xmlDom.item(lnl_product, li_product_cnt);
ls_batch_item := xslProcessor.valueOf(ln_product, 'AccountName');
END LOOP;
END LOOP;
END;
OUTPUT:
=========================================
3:32:41 PM *
**3:32:41 PM ORA-20100: Error occurred while processing: Namespace prefix 'a' used but not declared.**
3:32:41 PM ORA-06512: at "SYS.XSLPROCESSOR", line 22
3:32:41 PM ORA-06512: at "SYS.XSLPROCESSOR", line 502
3:32:41 PM ORA-06512: at line 50
3:32:41 PM *** Script stopped due to error ***
3:32:41 PM End SQL Editor ExecutionHi,
Something like this :
lnl_product := xslprocessor.selectNodes(
ln_doc_node
, '/s:Envelope/s:Body/AssetGetListResponse/AssetGetListResult/a:AssetFeed'
, 'xmlns:s="http://schemas.xmlsoap.org/soap/envelope/", xmlns="http://dev.services.xerox.com", xmlns:a="http://schemas.datacontract.org/2004/07/Xerox.MPS"'
li_product_max := xmlDom.getLength(lnl_product)-1;
FOR li_product_cnt IN 0..li_product_max LOOP
ln_product := xmlDom.item(lnl_product, li_product_cnt);
ls_batch_item := xslProcessor.valueOf(ln_product, 'a:AccountName', 'xmlns:a="http://schemas.datacontract.org/2004/07/Xerox.MPS"');
END LOOP;
...Or, using a single query :
SQL> SELECT extractValue(value(x), '/AssetFeed/AccountID', 'xmlns="http://schemas.datacontract.org/2004/07/Xerox.MPS"') as AccountID
2 , extractValue(value(x), '/AssetFeed/AccountName', 'xmlns="http://schemas.datacontract.org/2004/07/Xerox.MPS"') as AccountName
3 , extractValue(value(x), '/AssetFeed/AssetID', 'xmlns="http://schemas.datacontract.org/2004/07/Xerox.MPS"') as AssetID
4 , extractValue(value(x), '/AssetFeed/AssetNumber', 'xmlns="http://schemas.datacontract.org/2004/07/Xerox.MPS"') as AssetNumber
5 , extractValue(value(x), '/AssetFeed/SerialNumber', 'xmlns="http://schemas.datacontract.org/2004/07/Xerox.MPS"') as SerialNumber
6 FROM temp_table t
7 , TABLE(
8 XMLSequence(
9 EXTRACT(
10 XMLType(t.soap_response)
11 , '/s:Envelope/s:Body/AssetGetListResponse/AssetGetListResult/a:AssetFeed'
12 , 'xmlns:s="http://schemas.xmlsoap.org/soap/envelope/", xmlns="http://dev.services.xerox.com", xmlns:a="http://schemas.datacontract.org/2004/07/Xerox.MPS"'
13 )
14 )
15 ) x
16 WHERE t.call_id = 2
17 ;
ACCOUNTID ACCOUNTNAME ASSETID ASSETNUMBER SERIALNUMBER
de5862bf-f223-e011-bd3b-0024e861b15c MPS-API Sandbox ecf1545a-f1e9-e011-8a8a-0024e861b15c 57119B28 UTU101993N
de5862bf-f223-e011-bd3b-0024e861b15c MPS-API Sandbox b33b5160-f1e9-e011-8a8a-0024e861b15c 7EE42ADC PBB015012 -
Hello,
I am fairly new to CF and am trying to parse and then query a soap response from a third-party api. I have been able to get a response in xml format, but that is where I am stuck. Below the xml response I am getting an error that reads Element.LOGINRESPONSE.LOGINRESULT.XMLTEXT is undefined in LOGINXML.
I realize my code is a mess, but I am just trying out various things. Does anyone have any insight how to get at the Login Response variable in my soap response so that I can query it?
Thanks for any insight!!
<!--- WSDL --->
<cfset wsdl_url="http://somewebsite/sirewebsvc/sire.asmx?wsdl">
<cftry>
<!--- Compose SOAP message to send to Web Service--->
<cfsavecontent variable="soap"><?xml version="1.0" encoding="UTF-8" ?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<Login xmlns="http://www.siretechnologies.com/">
<LicenseKey>LicenseKey</LicenseKey>
<Username>username</Username>
<Password>password</Password>
<LicenseType>2</LicenseType>
<APIKey>APIKey</APIKey>
<SiteKey></SiteKey>
<CryptKey></CryptKey>
<WebOnly>false</WebOnly>
</Login>
</soapenv:Body>
</soapenv:Envelope>
</cfsavecontent>
<!--- Invoke web service to send message--->
<cfhttp url="#wsdl_url#" method="post" >
<cfhttpparam type="header" name="content-type" value="text/xml">
<cfhttpparam type="header" name="SOAPAction" value="http://www.siretechnologies.com/Login">
<cfhttpparam type="header" name="content-length" value="#len(soap)#">
<cfhttpparam type="header" name="charset" value="utf-8">
<cfhttpparam type="xml" name="message" value="#trim(soap)#">
</cfhttp>
<p><cfoutput>#xmlFormat(cfhttp.fileContent)#</cfoutput> </p>
<cfset MyXML = XmlParse(CFHTTP.FileContent)>
XmlSearch(MyXML, "/LoginResponse/LoginResult/")
<cfcatch type="any">
<cfdump var="#cfcatch#">
</cfcatch>
</cftry>
<cfsavecontent variable="XMLFile"><?xml version="1.0"?>
<LoginResponse>
<LoginResult>
???How do I get this from above, or make it a variable???
</LoginResult>
</LoginResponse>
</cfsavecontent>
<!--- Parse the XML --->
<cfset MyXMLDoc = xmlParse(XMLFile) />
<!--- Dump the XML --->
<h2>Dump</h2>
<cfdump var="#MyXMLDoc#">
<cfset MyNodes = xmlSearch(MyXMLDoc,'/LoginResponse/LoginResult')>
<cfoutput>
<h2>Nodes</h2>
<cfloop from="1" to="#arraylen(MyNodes)#" index="i">
<!--- The array contents need to parsed so you can easily get at the child nodes children and attributes. --->
<cfset LoginXML = xmlparse(MyNodes[i]) />
<b>SessionKey:</b> #LoginXML.LoginResponse.LoginResult.xmltext#<br>
</cfloop>
</cfoutput>
--->I think I figured it out. Thanks to all who helped!! If anyone is interested, this is how I retrieved the session key from my Soap response.
<!--- WSDL --->
<cfset wsdl_url="http://SOMEURL/sire.asmx?wsdl">
<!--- Compose SOAP message to send to Web Service--->
<cfsavecontent variable="soap"><?xml version="1.0" encoding="UTF-8" ?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<Login xmlns="http://www.siretechnologies.com/">
<LicenseKey>LicKey</LicenseKey>
<Username>user</Username>
<Password>pass</Password>
<LicenseType>2</LicenseType>
<APIKey>API</APIKey>
<SiteKey></SiteKey>
<CryptKey></CryptKey>
<WebOnly>false</WebOnly>
</Login>
</soapenv:Body>
</soapenv:Envelope>
</cfsavecontent>
<!--- Invoke web service to send message--->
<cfhttp url="#wsdl_url#" method="post" >
<cfhttpparam type="header" name="content-type" value="text/xml">
<cfhttpparam type="header" name="SOAPAction" value="http://www.siretechnologies.com/Login">
<cfhttpparam type="header" name="content-length" value="#len(soap)#">
<cfhttpparam type="header" name="charset" value="utf-8">
<cfhttpparam type="xml" name="message" value="#trim(soap)#">
</cfhttp>
<p><cfoutput>#xmlFormat(cfhttp.fileContent)#</cfoutput> </p>
<cfset MyXml = XmlParse(cfhttp.fileContent)>
<cfdump var="#MyXml#">
<cfset responseNodes = xmlSearch(MyXml,"//*[ local-name() = 'LoginResponse' ]")>
<cfdump var="#responseNodes#">
<cfoutput>
<cfloop from="1" to="#arraylen(responseNodes)#" index="i">
<cfset TheXML = xmlparse(responseNodes[i])>
<cfset SesKey = "#TheXML.LoginResponse.LoginResult.XmlText#">
<b>SessionKey:</b> #TheXML.LoginResponse.LoginResult.XmlText#<br>
<b>Session Key:#SesKey#
</cfloop>
</cfoutput> -
I am new to mobile web services. I need to create a parser but my code didnot work:( Could you please help me?
* To change this template, choose Tools | Templates
* and open the template in the editor.
import java.io.*;
import javax.microedition.midlet.*;
import org.ksoap2.SoapEnvelope;
import org.kxml2.io.KXmlParser;
import org.xmlpull.v1.XmlPullParserException;
import java.io.ByteArrayInputStream;
* @author Welcome
public class MobileSOAPParsingMidlet extends MIDlet {
String msg1="<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"> <S:Header/>" +
" <S:Body> <ns2:Add xmlns:ns2=\"http://webservice/\"> <x>5</x>" +
" <y>8</y> </ns2:Add> </S:Body></S:Envelope>";
String msg2 = " <Envelope Version= \"1\"> <Body> <WebService> <Action>Add</Action> <x>5</x> <y>8</y> </WebService> </Body></Envelope>";
String msg = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" " +
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n" +
" <getRating xmlns=\"http://tempuri.org\">\n" +
" </getRating>\n" +
" </soap:Body>\n" +
"</soap:Envelope>";
public void startApp() {
byte[] xmlByteArray = msg.getBytes();
ByteArrayInputStream xmlStream = new ByteArrayInputStream( xmlByteArray );
InputStreamReader xmlReader = new InputStreamReader( xmlStream );
KXmlParser parser = new KXmlParser();
try {
parser.setInput(xmlStream, msg);
} catch (XmlPullParserException ex) {
ex.printStackTrace();
SoapEnvelope soapenvelope=new SoapEnvelope(SoapEnvelope.VER12);
try {
soapenvelope.parse(parser);
} catch (IOException ex) {
ex.printStackTrace();
} catch (XmlPullParserException ex) {
ex.printStackTrace();
// catch(UnsupportedEncodingException e){
// System.err.println(e);
public void pauseApp() {
public void destroyApp(boolean unconditional) {
}I accidently hit the post before the messag was composed.
I'm trying to parse an XML soap envelope found in a collection. I can do it in TOAD but get a "ORA-01008: not all variables bound" message in APEX within a PL/SQL anonymous block
Here is the code snippet:
declare
l_xml clob;
l_pdf clob;
begin
select xmltype.createxml(cm.clob001)
into l_xmlval
from ....
select l_xmlval.extract('//*[local-name()=''reportBytes]').getclobval()
into l_pdf
from dual;
end;
It is the presense of the two backslashes that cause the ORA-01008. Does anybody know how to resolve this problem?
Alex -
Web service parsing soap envelope problem
I'm trying to parse an XML document found in a collection. I can do it in TOAD but get a "ORA-01008: not all variables bound" message in APEX.
I accidently hit the post before the messag was composed.
I'm trying to parse an XML soap envelope found in a collection. I can do it in TOAD but get a "ORA-01008: not all variables bound" message in APEX within a PL/SQL anonymous block
Here is the code snippet:
declare
l_xml clob;
l_pdf clob;
begin
select xmltype.createxml(cm.clob001)
into l_xmlval
from ....
select l_xmlval.extract('//*[local-name()=''reportBytes]').getclobval()
into l_pdf
from dual;
end;
It is the presense of the two backslashes that cause the ORA-01008. Does anybody know how to resolve this problem?
Alex -
Unable to parse soap fault due to SOAP version
The business logic deployed to my Weblogic server invokes a 3rd party web service. When the 3rd party web service throws a soap fault, the web service client fails to parse it:
SOAPFaultException - FaultCode [[http://schemas.xmlsoap.org/soap/envelope/]env.Server <http://schemas.xmlsoap.org/soap/envelope/%5denv.Server> <http://schemas.xmlsoap.org/soap/envelope/%5denv.Server> ] FaultString [RMSX1000:An unrecoverable system error has occured. please contact RMS support at [email protected] Message > [0]. [ java.rmi.RemoteException: /app/bea103/user_projects/domains/novella/<unknown>:0: error: com.bea.xml.XmlException: java.lang.IllegalArgumentException nested exception is:
com.bea.xml.XmlRuntimeException: /app/bea103/user_projects/domains/novella/<unknown>:0: error: com.bea.xml.XmlException: java.lang.IllegalArgumentException:/app/bea103/user_projects/domains/novella/<unknown>:0: error: com.bea.xml.XmlException: java.lang.IllegalArgumentException nested exception is:
com.bea.xml.XmlRuntimeException: /app/bea103/user_projects/domains/novella/<unknown>:0: error: com.bea.xml.XmlException: java.lang.IllegalArgumentException ]] FaultActor [NO ACTOR] Detail [<detail>
I used a network packet analyzer and found out that the soap fault structure is different as the 3rd party use the soap 1.1 implementation which has a different structure. My question is how do I generate the client stubs for a specific version (as currently they appear to be generated for Soap 1.2)? I reviewed the clientgen Ant task documentation and found no clue.
I think I may try to use stub._setProperty(WLStub.CONVERSATION_VERSION_PROPERTY, WLStub.CONVERSATION_VERSION_ONE) or some of its properties and see it that works - documentation is unclear.
Edited by: user8651233 on Oct 15, 2009 1:02 PMI used a network packet analyzer and found out that the soap fault structure is different as the 3rd party use the soap 1.1 implementation which has a different structureAre you using soap 1.1 when you invoke the service?
-
Hi all,
I'm trying to parse a response to a SOAP request and am not quite sure how to do this. I see in all the examples on the web and in the books where the information being returned is a simple type or a complex type and you can use Response.getReturnValue() to access the data.
Either something like,
<SOAP-ENV:Body>
<stockquoteresponse>
<stockprice>123.45</stockprice>
</stockquoteresponse>
</SOAP-ENV:Body> or
<SOAP-ENV:Body>
<stockquoteresponse>
<stock>
<tickersymbol>XYZ</tickersymbol>
<stockprice>123.45</stockprice>
</stock>
</stockquoteresponse>
</SOAP-ENV:Body> In my case however i have multiple pieces of information coming back and I am not sure how to encapsulate it in an object and if that is not possible, how to read it. I am getting something like,
<SOAP-ENV:Body>
<stockquoteresponse>
<tickersymbol>XYZ</tickersymbol>
<stockprice>123.45</stockprice>
</stockquoteresponse>
</SOAP-ENV:Body> Is it possible to get access to the stockquoteresponse element and deserialize that into an object ? In the examples I have seen, it doesn't seem to be possible.
Please help.There are standard APIs for reading SOAP message. e.g.
http://java.sun.com/webservices/docs/1.0/tutorial/doc/JAXM.html
If you try google you might find one approriate for you.
Maybe you are looking for
-
Removing Album Art From Zen V P
This being my first portable media player I've been experimenting. I managed to add some album art for one album via Creative Media Explorer. I think the full screen picture is good but I don't like the miniature picture which seems the default on th
-
I've lost the camera icon on the start screen.
When I first started my 4S I had a camera icon next to the slider. It's gone now. How do I restore it?
-
I am using serverSocket and the .accept() method to wait for a connection and I want to store the address of the computer that connects to the server. Is there a way to do this?
-
Min. row height table style
A new table in Indesign is by default set with a minimum row height of 1.058 mm. This 'minimum' feature is also visible in a table style (the 'exact' feature is not for some reason). When I import a table from Word for example, it's row height might
-
PDF Form Submit Alert to find missing fields
I have created a PDF form using Adobe Acrobat X Pro for our website and am testing it. When I submit my form, but have left required fields blank, I want it to locate those blank fields. Instead it makes me find the missing fields, which is hard to