Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

webservice different node levels

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
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…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

808 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