Skip to main content
Participant
August 6, 2017
Question

Axis problem

  • August 6, 2017
  • 1 reply
  • 479 views

Hi,

I'm using Coldfusion 11 and I'm trying to consume a web service but I'm getting the following error:

org.apache.axis2.AxisFault: An error occurred while checking the security for the message.

I can create an object of the WSDL and cfdump it, so there's no problem with the definition. The error occurs when I try to call one of the functions.

<cfset ws = createObject( "webservice", "https://testapi.kedin.nl/mediatorservice.svc?wsdl" )>
<cfdump var="#ws#">

Has anyone seen this error before?

Thanks

This topic has been closed for replies.

1 reply

BKBK
Community Expert
Community Expert
August 6, 2017

How are you consuming the web service? Your WSDL suggests you have to pass the security credentials by means of a Web Services Policy (WSP).

Participant
August 8, 2017

Hi BKBK,

Thanks for the reply. I wasn't clear in the original post. The webservice requires a username and password. The error occurs when I call one of the methods. It's not a CF problem. I'm sure there's some sort of incompatibility between the webservice and Axis - that's my guess. Here's the code:

<cfset ws = createObject( "webservice", "https://teststub.kedin.nl/KedinStubService.svc?wsdl", {username="StubUser",password="T68tlChm"} )>
<cfdump var="#ws#">
<cfset args = StructNew()>
<cfset args.testRequest.TestProperty = "Test working!">
<cfset x = ws.GetResponse( args )>
<cfdump var="#x#">

BKBK
Community Expert
Community Expert
August 9, 2017

That looks all right. Is the service perhaps expecting a SOAP request? What about trying something like

<!--- SOAP message to send to web service--->

  <cfsavecontent variable="msg"><?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>

            <getResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

                  <testRequest>

                      <testProperty>Test working!</testProperty>

                  </testRequest>

            </getResponse>

        </soapenv:Body>

    </soapenv:Envelope>

    </cfsavecontent>

    <cftry>

        <!--- Invoke web service to send message--->

        <cfhttp url="https://teststub.kedin.nl/KedinStubService.svc?wsdl" method="post" username="StubUser" password="T68tlChm">

            <cfhttpparam type="header" name="content-type" value="text/xml">

            <cfhttpparam type="header" name="accept-encoding" value="no-compression"/>

            <cfhttpparam type="header" name="SOAPAction" value="">

            <cfhttpparam type="header" name="content-length" value="#len(msg)#">

            <cfhttpparam type="header" name="charset" value="utf-8">

            <cfhttpparam type="xml" name="message" value="#trim(msg)#">

        </cfhttp>

        <cfdump var="#cfhttp#" >

    <cfcatch type="any">

        <cfdump var="#cfcatch#">

    </cfcatch>

    </cftry>

Does the provider provide any information on how to consume the service? That would offer us the best clue.