4 Replies Latest reply on Aug 10, 2017 12:38 AM by Cliff Mosdall

    Axis problem

    Cliff Mosdall Level 1

      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

        • 1. Re: Axis problem
          BKBK Adobe Community Professional & MVP

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

          • 2. Re: Axis problem
            Cliff Mosdall Level 1

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

            1 person found this helpful
            • 3. Re: Axis problem
              BKBK Adobe Community Professional & MVP

              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.

              • 4. Re: Axis problem
                Cliff Mosdall Level 1

                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