Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,065
    Thanks
    4
    Thanked 8 Times in 8 Posts

    Problem consuming webservice

    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
    Code:
      <?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?

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Code:
      <?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

  • #3
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,065
    Thanks
    4
    Thanked 8 Times in 8 Posts
    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

  • #4
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by miranda View Post
    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?
    Code:
      <?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

  • #5
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,065
    Thanks
    4
    Thanked 8 Times in 8 Posts
    no they are not a part of the xml.
    That code was copied from the browser so the little expanders/closers were pasted


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •