2017-06-15 6 views
2

私はWCFサービスエンドポイントを持っています。このサービスは、セキュリティモード= TransportWithMessageCredentialとメッセージセキュリティclientCredentialTypeをユーザー名/パスワード検証用のCustomValidatorを使用してユーザー名に設定したWCFサービスとして構成されます。 ColdFusion cfinvoke(Message Security - ClientCredentials =ユーザー名)

は、私はC#(作品)コンソールアプリケーションでこのコードを持っている:

ServiceClient client = new ServiceClient(); 
    client.ClientCredentials.UserName.UserName = "myusername"; 
    client.ClientCredentials.UserName.Password = "mypassword"; 
    Console.WriteLine(client.GetVersion()); 

上記のコードが動作する - のcfinvokeを使用してColdFusion同等物は何ですか? 私は現在

<cfinvoke 
webservice="#wsurl#" 
method="getVersion" 
returnvariable="gcversion" 
refreshwsdl="true"> 
</cfinvoke> 

(ユーザー名/パスワードの導入前に大丈夫働いている)は、次のしている場合は「クライアントの資格」を含めるために適切な場所はありますか?

EDIT:サービスが「WS-Security」を使用しているようです。私はCF2016のWS-Securityのサポートについての情報を見つけるのに苦労しています。これは標準だと思われるので、なぜ情報を見つけるのが難しいのか不明です。

誰でもリソースを提供できれば、本当に感謝しています。

EDIT2: 私はこれを行うにしようとしています: `` ` WS =のCreateObject( "Webサービス"、wsurl、{refreshwsdl =真});

objSoapHeader = XmlParse("<wsse:Security mustUnderstand=""false"" xmlns:wsse=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd""><wsse:UsernameToken><wsse:Username>myun</wsse:Username><wsse:Password>mypass</wsse:Password></wsse:UsernameToken></wsse:Security>"); 

addSOAPRequestHeader(ws, "ignoredNameSpace", "ignoredName", objSoapHeader,false); 

version =ws.getVersion(); 
writeOutput(version); 

が、次のエラー受け付けております:お使いのServiceClient()の詳細を知らなくても

Cannot perform web service invocation getVersion. 
The fault returned when invoking the web service operation is: 

org.apache.axis2.AxisFault: Must Understand check failed for header http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd : Security 

    at org.apache.axis2.engine.AxisEngine.checkMustUnderstand(AxisEngine.java:105) 

    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:171) 

    at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:364) 

    at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421) 

    at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229) 

    at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165) 

    at cwtgift.CWTGiftServiceStub.getVersion(CWTGiftServiceStub.java:1954) 

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 

    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 

    The error occurred in C:/ColdFusion2016/cfusion/wwwroot/test/getVersion.cfm: line 19 

    17 :  addSOAPRequestHeader(ws, "ignoredNameSpace", "ignoredName", objSoapHeader,false); 
    18 : 
    19 :  version =ws.getVersion(); 
    20 :  writeOutput(version); 
    21 : </cfscript> 

答えて

2

は、私がcfinvokeargumentを使用して容疑者は、おそらくあなたのユーザー名/パスワードを渡すための最も簡単な方法です:

<cfinvoke webservice="#wsurl#" 
    method="getVersion" 
    returnvariable="gcversion" 
    refreshwsdl="true"> 

    <cfinvokeargument name="UserName" value="myusername" /> 
    <cfinvokeargument name="Password" value="mypassword" /> 

</cfinvoke> 

エンドポイントにヒットする必要がある場合

<cfhttp url="" method="" throwOnError="" multipart="" path="" file="" name="" result=""> 

    <cfhttpparam type="" name="UserName" value="myusername" /> 
    <cfhttpparam type="" name="Password" value="mypassword" /> 

</cfhttp> 
+0

が追加を追加しました:Webサービスとして設定さtは、あなたも(あなたはすべての詳細についてはhttps://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-tags/tags-g-h/cfhttp.htmlを参照したいと思う、私はここにすべての引数または値を詳細に説明していない)、同様の方法でCFHTTPを使用することができます質問への詳細 –

+0

基本認証ですか?その場合は、代わりにユーザー名とパスワードの属性を試してください。 – Leigh

+0

こんにちは@Leigh、私はそれが基本認証だとは思わない。これがWSS認証です。 Soap UIでは、WSS Password Typeを 'Text'に設定してから、基本的にユーザー名とパスワードを使用する必要があります。 authTypeをBASICに設定するだけでなく、ユーザ名とパスワードの属性を使用しようとしました –

関連する問題