Solved

webservice different node levels

Posted on 2013-05-27
3
264 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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
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…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

679 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