• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Axis problem

Community Beginner ,
Aug 06, 2017 Aug 06, 2017

Copy link to clipboard

Copied

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

Views

397

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 06, 2017 Aug 06, 2017

Copy link to clipboard

Copied

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).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 08, 2017 Aug 08, 2017

Copy link to clipboard

Copied

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#">

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 09, 2017 Aug 09, 2017

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 10, 2017 Aug 10, 2017

Copy link to clipboard

Copied

LATEST

Thanks for taking the time to do that! I've tried that and various other things including addSOAPRequestHeader.

After days making attempts, the webservice provider is now writing a wrapper that does not need authentication in the request. I'll be providing a Token as part of the function call for security.

Once again, thanks for all your efforts.

Cliff

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation