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

Authentication error when using cfinvoke

Community Beginner ,
Jan 18, 2018 Jan 18, 2018

Copy link to clipboard

Copied

Hi, I'm using Coldfusion 2016 and trying to consume a SAP web service using cfinvoke

The web Service requires authentication, so I'm including a username and password in the cfinvoke tag:

<cfinvoke

webservice="http://server:port/sap/bc/.../..bld?sap-client=xxx"

username="MY-USERNAME"

password="mypassword"

refreshWSDL="yes"

method="MY_METHOD"

returnvariable="SAPRet">

<cfinvokeargument name="ARG" value="0021002003" />

</cfinvoke>

I can trace the call to the webservice in Wireshark and see that the WSDL is retrieved just fine, but calling the actual method results in an "authorization failed" error. It seems that username/password specified in the cfinvoke tag are only used for retrieving the WSDL, as can be seen in the Wireshark trace, but they are not used for calling the method.

Same error occurs when using cfobject to consume the webservice.

When using SoapUI to consume the web service, I have to input username/password twice: Once for downloading the WSDL and once inside the request properties of the method.

How can I make cfinvoke (or cfobject) include username/password in the request properties?

TOPICS
Advanced techniques

Views

648

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 ,
Jan 18, 2018 Jan 18, 2018

Copy link to clipboard

Copied

When you try to call it as a cfobject/createobject, and then you call the method separately, did you try passing in a username/password combination as arguments, like you say you were offered to do in SoapUI? Maybe it’s that the method (of the web service) is requiring that.

Another thought: had you tried setting the wsversion attribute (on cfinvoke or cfobject, or as can be set for createobject as a corresponding key in the argstruct passed on the function call) to 1 or 2? That would change the behavior from axis1 to axis2, and may change how the authentication works. (Whether you should use 1 or 2 depends also on what you CF Admin or application level setting for wsversion is, as to whether you would need to override it on the tag like this.)

I realize I may seem to be speaking over your head, if you are new to all this. But if that helps you take the ball and run with it, great.

/charlie


/Charlie (troubleshooter, carehart.org)

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 ,
Jan 19, 2018 Jan 19, 2018

Copy link to clipboard

Copied

Hi Charlie,

thanks for your suggestions, but neither changing wsversion from 2 to 1 nor passing username and password as arguments to the method make it work.

In SoapUI, the username and password are request properties, not arguments to the request. Is there any way to change or add request properties in cfinvoke/cfobject?

Has anybody ever successfully used cfinvoke or cfobject to consume a SAP webservice with recent Coldfusion versions? Or any non-Coldfusion webservice that requires authentication?

Regards, Richard

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 ,
Jan 20, 2018 Jan 20, 2018

Copy link to clipboard

Copied

I don't know the answer to your question. But I have worked with SOAP requests to non-CF services that require authentication before.

Normally, when a browser makes a request that requires web server authentication (Basic, Windows, digest), the browser will request the URL without credentials, receive an authentication error from the server, request the URL with credentials (after collecting them from the user), then automatically send the credentials for every subsequent request. But if it goes to another server that also requires credentials, it will have to repeat that process.

So, my question is, are the WSDL and the actual service on separate servers? This is allowed, but is not that common. If that's not the case, I'd open a support ticket with Adobe, because this seems like an obvious bug.

Dave Watts, CTO, Fig Leaf Software

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 ,
Jan 26, 2018 Jan 26, 2018

Copy link to clipboard

Copied

Hi Dave,

thanks for your answer. In our case, the URL for the WSDL and for the actual webservice are indeed different, the service URLs are specified inside the WSDL in a <soap: address location> tag. They are not on a different Server, however, but in a completely different path.

It could well be that cfinvoke has a problem handling this. We don't have an Adobe support contract, so I cannot open a ticket with them, but I decided to abort the cfinvoke route and use cfhttp instead. I used SoapUI to determine the XML necessary to call the Service and copy/pasted that into my Coldfusion Code, works like a charm.

Problem not solved, but sufficient workaround found.

Regards, Richard

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 ,
Feb 20, 2018 Feb 20, 2018

Copy link to clipboard

Copied

Thanks for sharing that. Please mark it as the correct answer. It will surely help someone else.

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 ,
Feb 20, 2018 Feb 20, 2018

Copy link to clipboard

Copied

LATEST

I see you have solved your problem, rspitzmd, but to be clear, you don't need any support agreement to open a ticket. What Dave was referring to (I'm sure) is the free, open Adobe CF bug reporting system, at tracker.adobe.com.


/Charlie (troubleshooter, carehart.org)

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