0 Replies Latest reply on Nov 4, 2008 11:40 AM by jim1234

    Controlling the soap response in publishing a web service

    jim1234 Level 1
      Hi all,

      Another web service question. I would like to know how you might control the SOAP response from a web service that is being published. Cold Fusion puts in its own Envelope, Header and Return tags on whatever you might return from the component function that is being called. I want to control these myself, because what Coldfusion is returning is not what the client expects. Currently my code looks like this:

      <cffunction name="agencyActivation" access="remote" output="false" returntype="XML">
      <cfargument name="agencyActivationMessage" type="XML" required="true">

      <cfsavecontent variable="SoapResponse">
      <soapenv:Envelope xmlns:soapenv=" http://schemas.xmlsoap.org/soap/envelope/" xmlns:gov="gov:research:services:activation:ws" xmlns:gov1="gov:research:services:activation">
      <soapenv:Header/>
      <soapenv:Body>
      <gov:agencyActivationResponse>
      <gov1:agencyValidationMessage>
      <gov1:agencyIdentity>
      <gov1:activationStatus>Successful</gov1:activationStatus>
      </gov1:agencyIdentity>
      </gov1:agencyValidationMessage>
      </gov:agencyActivationResponse>
      </soapenv:Body>
      </soapenv:Envelope>
      </cfsavecontent>


      <cfreturn SoapResponse/>
      </cffunction>
      </cfcomponent>

      But Coldfusion returns this:

      <?xml version="1.0" encoding="utf-8"?>
      <soapenv:Envelope xmlns:soapenv=" http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd=" http://www.w3.org/2001/XMLSchema" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Body>
      <ns1:agencyActivationResponse soapenv:encodingStyle=" http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="gov:research:services:activation:ws">
      <agencyActivationReturn xsi:type="ns2:Document" xmlns:ns2=" http://xml.apache.org/xml-soap">
      <soapenv:Envelope xmlns:gov="gov:research:services:activation:ws" xmlns:gov1="gov:research:services:activation">
      <soapenv:Header/>
      <soapenv:Body>
      <gov:agencyActivationResponse>
      <gov1:agencyValidationMessage>
      <gov1:agencyIdentity>
      <gov1:activationStatus>Successful Validation</gov1:activationStatus>
      </gov1:agencyIdentity>
      </gov1:agencyValidationMessage>
      </gov:agencyActivationResponse>
      </soapenv:Body>
      </soapenv:Envelope>
      </agencyActivationReturn>
      </ns1:agencyActivationResponse>
      </soapenv:Body>
      </soapenv:Envelope>

      So ColdFusion adds it's own Envelope, Header, Body, and agencyActivationReturn tags. I don't want coldfusion to do this.

      Any suggesstions?

      Thanks,
      Jim