Solved

webservice different node levels

Posted on 2013-05-27
3
258 Views
Last Modified: 2013-05-28
I am trying to connect to a web service using asp post
 Set objHTTP =  CreateObject("WinHttp.WinHttpRequest.5.1")
vPostData = "op=ValidateTinName&TIN=" & request.form("taxid") & "&LName="  & request.form("Name") & "&UserLogin=*****g&UserPassword=***#"
objHTTP.Open "POST", "https://www.****", false
objHTTP.Send  vPostData
response.write(objHTTP.ResponseText)

Open in new window

I am getting an error " Data at the root level is invalid."
The page is asking for xml is different levels. How would I change my postdata to represent that.
 <ValidateTinName xmlns="******">
      <TinName>
        <TIN>string</TIN>
        <LName>string</LName>
        <FName>string</FName>
        <Encryption>string</Encryption>
      </TinName>
      <CurUser>
        <UserID>string</UserID>
        <UserLogin>string</UserLogin>
        <UserPassword>string</UserPassword>
        <UserEncryption>string</UserEncryption>
      </CurUser>
    </ValidateTinName>
  </soap:Body>
</soap:Envelope>

Open in new window

0
Comment
Question by:rivkamak
  • 2
3 Comments
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39200145
This is a soap call.  You have to post the entire envelope.   For other languages like php and ruby, there are libraries to make this easy.  For those of us using ASP, we have to take the long way and convert the envelope (XML) to a string and post the string.    If you are using variable, place them in the xml as I have sampled.

if request.form("TIN")<>"" then ' test for data
     TIN=request.form("TIN")
     else
     TIN=""  ' make sure to not send null data
end if

theXML="<ValidateTinName xmlns=""******"">"  ' notice double quotes
theXML=theXML&"<TinName>"
theXML=theXML&"<TIN>"&TIN&"</TIN>"
       ' do this for each node
theXML=theXML&"</soap:Envelope>"

Set objHTTP =  CreateObject("WinHttp.WinHttpRequest.5.1")
vPostData = theXML
objHTTP.Open "POST", "https://www.****", false
objHTTP.Send  vPostData
response.write(objHTTP.ResponseText)

Open in new window

0
 

Author Comment

by:rivkamak
ID: 39200186
I fixed up the whole xml envelope.

What's with this error now?

The server cannot service the request because the media type is unsupported.
0
 
LVL 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 total points
ID: 39200263
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Accessibility and Usability are two concepts that seem to be closely related.  But, too many people seem to have a distorted perception of them. During last five years, those two words have come to the day-to-day work of almost every web develope…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now