...

View Full Version : Problem consuming webservice



miranda
07-10-2008, 09:37 PM
I am trying to consume a webservice, There are 2 soap envelopes that must get sent. In the first soap envelope, I log in to the webservice, they respond back with the credentials that I need for the second envelope. In the second envelope I send the login credentials in the soap:header and the xml parameters in the soap:body. At this point the webservice throws an error and I see nothing back unless I make an intentional mistake in the xml then I can see the errors.

here is an example of the second soap:envelope as it is sent over


<?xml version="1.0" encoding="utf-8" ?>
- <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
- <soap12:Header>
- <FastraxLogin xmlns="http://www.fastraxonline.com/webservices/request/">
<EXPIRE>45</EXPIRE>
<loginToken>7f5fa7c7-3b86-4391-a200-1d4cc7001f35</loginToken>
<customerID>ABC123</customerID>
<custLocation>ABC123#00000</custLocation>
<clientType>BRANCH</clientType>
<ipAddr>10.10.0.1</ipAddr>
- <pubKey>
- <RSAKeyValue>
<Modulus>vZnF7B07kPf1iIIk+gMiIBkez5srL39LeUHgF8ROeGtjkXNPJraeyw5h87xk0oEO/taD9dHrabRuQuAu0BZKPFXqxWeEE7+i2ET5kMGJKhdsI0cSnwwB2zzXwSGp9YeRwxtXZSsCmok27/he0oR+m0EK7ofDOBNRSvRx6LX4/Fs=</Modulus>
<Exponent>AQAB</Exponent>
</RSAKeyValue>
</pubKey>
<sessionStart>2008-07-10T16:23:34.8784619-04:00</sessionStart>
</FastraxLogin>
</soap12:Header>
- <soap12:Body>
- <InsertRequests xmlns="http://www.fastraxonline.com/webservices/request/">
- <xmlString>
<?xml version="1.0" encoding="utf-8" ?>
- <FastraxRequests>
- <request>
- <subject-info>
<first-name>Miranda</first-name>
<last-name>Test</last-name>
<dob>1958-12-23</dob>
<ssn>123-45-6789</ssn>
<sex>F</sex>
- <address-info>
- <address>
<street-name>123 main st</street-name>
<city>DFW</city>
<state>TX</state>
<zip>75050</zip>
</address>
</address-info>
<maiden-name>Ramig</maiden-name>
<felony-misd>False</felony-misd>
<served-time>False</served-time>
<criminal-explan />
</subject-info>
- <report-info>
- <combined-report combined-report-id="798">
- <report-data>
- <criminalcounty>
- <location-info>
<state>TX</state>
<county>Tarrant</county>
</location-info>
</criminalcounty>
<ssntracereport />
</report-data>
</combined-report>
</report-info>
- <notifications>
<email-addr />
</notifications>
</request>
</FastraxRequests>
</xmlString>
</InsertRequests>
</soap12:Body>
</soap12:Envelope>


which throws this error on the server :
HTTP/ASMX Message Receive Failure: System.Xml.XmlException: Unexpected XML declaration. The XML declaration must be the first node in the document, and no white space characters are allowed to appear before it. Line 1, position 951.

However if I remove the XML declaration from inside the xmlstring node then I get a different error. I am stuck any ideas?

oesxyl
07-10-2008, 09:52 PM
<?xml version="1.0" encoding="utf-8" ?>
- <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
- <soap12:Header>
- <FastraxLogin xmlns="http://www.fastraxonline.com/webservices/request/">
<EXPIRE>45</EXPIRE>
<loginToken>7f5fa7c7-3b86-4391-a200-1d4cc7001f35</loginToken>
<customerID>ABC123</customerID>
<custLocation>ABC123#00000</custLocation>
<clientType>BRANCH</clientType>
<ipAddr>10.10.0.1</ipAddr>
- <pubKey>
- <RSAKeyValue>
<Modulus>vZnF7B07kPf1iIIk+gMiIBkez5srL39LeUHgF8ROeGtjkXNPJraeyw5h87xk0oEO/taD9dHrabRuQuAu0BZKPFXqxWeEE7+i2ET5kMGJKhdsI0cSnwwB2zzXwSGp9YeRwxtXZSsCmok27/he0oR+m0EK7ofDOBNRSvRx6LX4/Fs=</Modulus>
<Exponent>AQAB</Exponent>
</RSAKeyValue>
</pubKey>
<sessionStart>2008-07-10T16:23:34.8784619-04:00</sessionStart>
</FastraxLogin>
</soap12:Header>
- <soap12:Body>
- <InsertRequests xmlns="http://www.fastraxonline.com/webservices/request/">
- <xmlString><![CDATA[
- <FastraxRequests>
- <request>
- <subject-info>
<first-name>Miranda</first-name>
<last-name>Test</last-name>
<dob>1958-12-23</dob>
<ssn>123-45-6789</ssn>
<sex>F</sex>
- <address-info>
- <address>
<street-name>123 main st</street-name>
<city>DFW</city>
<state>TX</state>
<zip>75050</zip>
</address>
</address-info>
<maiden-name>Ramig</maiden-name>
<felony-misd>False</felony-misd>
<served-time>False</served-time>
<criminal-explan />
</subject-info>
- <report-info>
- <combined-report combined-report-id="798">
- <report-data>
- <criminalcounty>
- <location-info>
<state>TX</state>
<county>Tarrant</county>
</location-info>
</criminalcounty>
<ssntracereport />
</report-data>
</combined-report>
</report-info>
- <notifications>
<email-addr />
</notifications>
</request>
</FastraxRequests>
]]></xmlString>
</InsertRequests>
</soap12:Body>
</soap12:Envelope>

try to use CDATA, it's just a idea, I don't know if could help.
what is the second error message? ( if you remove xml decl.)
another idea is to check if you everything is valid utf-8 and if you can validate xml to see if is something wrong.

regards

miranda
07-11-2008, 12:31 AM
I tried the CData prior to the post with no luck. If i remove the 2nd xml declaration then i get a message that says it is invalid XML missing the declaration so i am darned if i do and darned if i don't

oesxyl
07-11-2008, 01:00 AM
I tried the CData prior to the post with no luck. If i remove the 2nd xml declaration then i get a message that says it is invalid XML missing the declaration so i am darned if i do and darned if i don't
and validation?

in your xml, you have this?


<?xml version="1.0" encoding="utf-8" ?>
- <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
- <soap12:Header>
- <FastraxLogin xmlns="http://www.fastraxonline.com/webservices/request/">
<EXPIRE>45</EXPIRE>
<loginToken>7f5fa7c7-3b86-4391-a200-1d4cc7001f35</loginToken>
<customerID>ABC123</customerID>
<custLocation>ABC123#00000</custLocation>
<clientType>BRANCH</clientType>
<ipAddr>10.10.0.1</ipAddr>
- <pubKey>
- <RSAKeyValue>
<Modulus>vZnF7B07kPf1iIIk+gMiIBkez5srL39LeUHgF8ROeGtjkXNPJraeyw5h87xk0oEO/taD9dHrabRuQuAu0BZKPFXqxWeEE7+i2ET5kMGJKhdsI0cSnwwB2zzXwSGp9YeRwxtXZSsCmok27/he0oR+m0EK7ofDOBNRSvRx6LX4/Fs=</Modulus>
<Exponent>AQAB</Exponent>
</RSAKeyValue>
</pubKey>
<sessionStart>2008-07-10T16:23:34.8784619-04:00</sessionStart>
</FastraxLogin>
</soap12:Header>
- <soap12:Body>
- <InsertRequests xmlns="http://www.fastraxonline.com/webservices/request/">
- <xmlString>
<?xml version="1.0" encoding="utf-8" ?>
- <FastraxRequests>
- <request>
- <subject-info>
<first-name>Miranda</first-name>
<last-name>Test</last-name>
<dob>1958-12-23</dob>
<ssn>123-45-6789</ssn>
<sex>F</sex>
- <address-info>
- <address>
<street-name>123 main st</street-name>
<city>DFW</city>
<state>TX</state>
<zip>75050</zip>
</address>
</address-info>
<maiden-name>Ramig</maiden-name>
<felony-misd>False</felony-misd>
<served-time>False</served-time>
<criminal-explan />
</subject-info>
- <report-info>
- <combined-report combined-report-id="798">
- <report-data>
- <criminalcounty>
- <location-info>
<state>TX</state>
<county>Tarrant</county>
</location-info>
</criminalcounty>
<ssntracereport />
</report-data>
</combined-report>
</report-info>
- <notifications>
<email-addr />
</notifications>
</request>
</FastraxRequests>
</xmlString>
</InsertRequests>
</soap12:Body>
</soap12:Envelope>


regards

miranda
07-11-2008, 04:24 PM
no they are not a part of the xml.
That code was copied from the browser so the little expanders/closers were pasted



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum