Skip to main content
Participant
July 16, 2009
Question

Problem with hhtp post to schema based webservices

  • July 16, 2009
  • 1 reply
  • 513 views

I would like to make a http post for update a contact database via schema based web services using JSON and did the following:

The content is :

<cfset content2 = '{"estateServiceUpdateContactRequest":{"__type":"EstateServiceUpdateContactRequest:Whoman.Estate","ClientID":"#attributes.clientWSkey#","Address1":"Stationstraat","Address2":"","AgreementMail":0,"AgreementSms":0,"Box":"","City":"Tervuren","Comments":"Test contact created from own website","ContactOriginID":"190","ContactTitleID":1016,"ContactTypeIDList":[7194,7195],"CountryID":1,"FirstName":"Hugo","LanguageID":"nl-BE","Message":"This is the message for the test contact created from own website","Name":"Claestest","Number":"10","OfficeID":993,"PrivateEmail":"dttfghsf@scarlet.be","PrivateTel":"+32 (0)456/23.45.24","SearchCriteria":{"__type":"EstateServiceUpdateContactRequestSearchCriteria:Whoman.Estate","CategoryIdList":[1,2],"PriceRange":[10,1000000],"PurposeIdList":[1,2],"PurposeStatusIdList":[1,2],"RegionIDList":[1822,1823],"SubCategoryIdList":[2,1]},"Zip":"1200"}}'>

<cfparam name="WSURL" default="http://193.74.68.130/websiteservices/EstateService.svc/">

<cfhttp  url = "#WSURL#UpdateContact" method="post" throwonerror="Yes" charset="UTF-16">

            <cfhttpparam type="XML" name="BODY" value="#content2#">

</cfhttp>

It looks like the request gets on the server but I get a “bad request” return (the logs of the IIS also returns a Coldfusion 400 0 0 error).

Using the code

<cfhttp  url = "#WSURL#UpdateContact" method="post" throwonerror="Yes" charset="UTF-16">

            <cfhttpparam type="BODY" value="#content2#">

</cfhttp>

gives a Coldfusion server error.

    This topic has been closed for replies.

    1 reply

    ilssac
    Inspiring
    July 16, 2009

    Well the first thing I would discuss is if this webservice expects XML, it does not look like you are sending it XML.

    <cfset content2 = '{"estateServiceUpdateContactRequest":{"__type":"EstateServiceUpdateContactRequ est:Whoman.Estate","ClientID":"#attributes.clientWSkey#","Address1":...

    This is not xml data is it?

    jewa_whAuthor
    Participant
    July 17, 2009

    Hello Ian,

    Thanks for looking at the problem.

    No indeed, the data are in JSON but the cfhttpparam does not seem to accept

    JSON (blocked immediately by the coldfusion server).

    Best regards

    Jean