Skip to main content
hui-huangk69511027
Participant
January 28, 2020
Question

How to upload XML data to a DotNet URL using CFHTTP tag, and get the XML reply ?

  • January 28, 2020
  • 1 reply
  • 469 views

I want to upload XML data to a DotNet webservice, the access URL is

http://ap.fishtap.org.tw/breednWebSvc/App/WaterQuality.asmx,

and the interface method is uploadSvc(string sXML)

 

the XML data as follow :

<?xml version="1.0" encoding="utf-8"?>

<WQList>

  <orgid>402665</orgid>

  <change_date>2020/01/28</change_date>

  <boxtag>

    <boxid>18364</boxid>

    <workdetail>

      <hhmmss>11:19:04</hhmmss>

      <w_no></w_no>

      <water_no></water_no>

      <warm>22.1</warm>

      <ph>8.09</ph>

      <dissolve>5.78</dissolve>

      <salt>44.1</salt>

      <wa01>7.481</wa01>

      <wa02>0</wa02>

      <wa03>0</wa03>

    </workdetail>

  </boxtag>

</WQList>

 

If be performed, the reply XML data will be follow :

<?xml version="1.0" encoding="utf-8"?>

<WQListReply>

  <orgid>402665</orgid>

  <Status>1(Successful) or -1(Failure)</Status>

  <ErrMsg>Failure description</ErrMsg>

</WQListReply>

 

 

My coldfusion code as follow :

<CFXML Variable="xmlObject">

  <?xml version="1.0" encoding="utf-8"?>

  <WQList>

    <orgid>402665</orgid>

    <change_date>2019/12/31</change_date>

    <boxtag>

      <boxid>18364</boxid>

      <workdetail>

        <hhmmss>11:19:04</hhmmss>

        <w_no></w_no>

        <water_no></water_no>

        <warm>22.1</warm>

        <ph>8.09</ph>

        <dissolve>5.78</dissolve>

        <salt>44.1</salt>

        <wa01>7.481</wa01>

        <wa02>0</wa02>

        <wa03>0</wa03>

      </workdetail>

    </boxtag>

  </WQList>

</CFXML>

<CFHTTP Url="http://ap.fishtap.org.tw/breednWebSvc/App/WaterQuality.asmx"

        Method="get"

        Result="httpResponse">

  <CFHTTPPARAM Type="xml"

               Value="#xmlObject#">

</CFHTTP>

httpResponse.statusCode =<CFOUTPUT>#httpResponse.statusCode#</CFOUTPUT>

 

httpResponse.statusCode is 200(OK),

but it does nothing, XML data is not written, where’s wrong ?

 

I don’t understand DotNet webservice usage, how to use the interface method ?

and how to get the reply XML data ?

 

Thanks all.

 

This topic has been closed for replies.

1 reply

Community Expert
January 28, 2020

This probably isn't a .NET issue, just how web services are used in general. I can't see any interface for the web service - I just get a 403 error when I try the URL - but I see you're sending the XML in a GET request. Most web services require a POST request.

 

Dave Watts, Eidolon LLC

Dave Watts, Eidolon LLC