Quantcast
Channel: Adobe Community : Discussion List - ColdFusion
Viewing all articles
Browse latest Browse all 6243

Sending XML formatted text to web service

$
0
0

I have a series of forms that send information to various web services.

 

One is a login form, which consists of a username/password combo, and some other credentials specified in the code.  My CF code looks like this:

 

<cfinvoke    webservice="https://my.web.service.url/login?wsdl"    method="userLookupBySession"    returnvariable="appauth">        <cfinvokeargument name="applicationName" value="MYAPP" />        <cfinvokeargument name="accessCode" value="123456" />        <cfinvokeargument name="sessionId" value="#session.appid#" />        <cfinvokeargument name="endUserIPAddress" value="#CGI.REMOTE_ADDR#" /></cfinvoke>

 

And that works quite well.

 

Another form is a registration form.  Like the one above, it accepts four arguments.

  • Application name
  • Access code
  • User data, formatted as XML
  • User's IP address.

 

Here's my code:

 

<cfxml variable="userData"><cfoutput><USER xmlns:xsi="_http://www.w3.org/2001/XMLSchema-instance">    <ROW NUM="1">        <LOGIN_ID>#htmleditformat(userid)#</LOGIN_ID>        <PASSWORD>#htmleditformat(FORM.password)#</PASSWORD>        <NAME_LAST>#htmleditformat(FORM.name_last)#</NAME_LAST>        <NAME_FIRST>#htmleditformat(FORM.name_first)#</NAME_FIRST>        <NAME_MI></NAME_MI>        <EMAIL>#htmleditformat(FORM.email)#</EMAIL>        <OFFICE_PHONE>#htmleditformat(FORM.office_phone)#</OFFICE_PHONE>        <OFFICE_EXT>#htmleditformat(FORM.office_ext)#</OFFICE_EXT>        <OFFICE_FAX></OFFICE_FAX>        <OFFICE_STREET1>#htmleditformat(FORM.office_street1)#</OFFICE_STREET1>        <OFFICE_STREET2>#htmleditformat(FORM.office_street2)#</OFFICE_STREET2>        <OFFICE_CITY>#htmleditformat(FORM.office_city)#</OFFICE_CITY>        <OFFICE_STATE>#htmleditformat(FORM.office_state)#</OFFICE_STATE>        <OFFICE_ZIP>#htmleditformat(FORM.office_zip)#</OFFICE_ZIP>        <ORG_TYPE>#htmleditformat(FORM.org_type)#</ORG_TYPE>        <ORG_NAME>#htmleditformat(FORM.org_name)#</ORG_NAME>        <USER_TYPE>J</USER_TYPE>    </ROW></USER></cfoutput></cfxml>

And:

 

<cfinvoke    webservice="https://my.web.service.url/register?wsdl"    method="registerRequest"    returnvariable="regged">        <cfinvokeargument name="applicationName" value="MYAPP" />        <cfinvokeargument name="accessCode" value="123456" />        <cfinvokeargument name="userData" value="#userData#" />        <cfinvokeargument name="endUserIPAddress" value="#CGI.REMOTE_ADDR#" /></cfinvoke>

 

For some reason this fails, but if I have one of the server guys use the raw XML data, it works fine, so there's something wrong with my cfinvoke.

 

Has anyone else passed XML data to a web service?  Is there any special thing you need to do to format it?


Viewing all articles
Browse latest Browse all 6243

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>