自分自身を保護するために、WS-Security(username + password)を使用するサービスに接続しようとしています。ColdFusion 2016(WS-Security実装)
<cfxml variable="securityHeaders">
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-65" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>myusername</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">mypassword</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">1vrSoBRiARpSIXvhXExgqg==</wsse:Nonce>
<wsu:Created>2017-07-07T20:07:22.041Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</cfxml>
<cfscript>
ws = createObject("webservice", #wsurl#,{wsversion="2",refreshWSDL=true});
WriteDump(#securityHeaders#);
AddSoapRequestHeader(ws, "","",#securityHeaders#,true);
version = ws.GetVersion();
</cfscript>
しかし、ColdFusionが私のXMLについて何かを好きではないようです:私は私のコードは、現在このようになりますColdFusionの2016
から接続しています。私はsoapenvを削除した場合
An error occurred while Parsing an XML document.
The prefix "soapenv" for attribute "soapenv:mustUnderstand" associated with an element type "wsse:Security" is not bound.
The error occurred in C:/ColdFusion2016/cfusion/wwwroot/test/getVersion.cfm: line 12
10 : </cfif>
11 :
12 : <cfxml variable="securityHeaders">
13 : <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
14 : <wsse:UsernameToken wsu:Id="UsernameToken-65" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
:私はこのエラーが発生しますのmustUnderstand =「1」は、私は別のエラーが表示されるが、私の理解では、それはそこにする必要があるということです。このXMLで私が間違っていることはありますか? soapenvについて知らない理由はありますか?mustUnderstand?
洞察力があれば幸いです。ありがとうございます。
EDIT 1 は、この変更は、問題を修正しました:
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
しかし、今、私は次のことを受け付けております:
Cannot perform web service invocation GetVersion.
The fault returned when invoking the web service operation is:
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}MustUnderstand
faultSubcode:
faultString: Did not understand "MustUnderstand" header(s):
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:96)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
at org.apache.axis.client.Call.invoke(Call.java:2748)
at org.apache.axis.client.Call.invoke(Call.java:2424)
at org.apache.axis.client.Call.invoke(Call.java:2347)
at org.apache.axis.client.Call.invoke(Call.java:1804)
これはワーキングエンベロープです:
<soapenv:Envelope xmlns:abc="ABCService" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header><wsse:Security soapenv:mustUnderstand="1"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-41D8D78B82FF48D24D149946784898124">
<wsse:Username>usernamegoeshere</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">passgoeshere</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">noncehere</wsse:Nonce>
<wsu:Created>2017-07-07T22:50:48.980Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security></soapenv:Header>
<soapenv:Body>
<abc:GetVersion/>
</soapenv:Body>
</soapenv:Envelope>
これは私が見ることができる失敗している封筒です私の痕跡で
<MessageHeaders>
<wsse:Security soapenv:mustUnderstand="1" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" soapenv:actor="">
<wsse:UsernameToken wsu:Id="UsernameToken-65" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>
<!-- Removed-->
</wsse:Username>
<wsse:Password>
<!-- Removed-->
</wsse:Password>
<wsse:Nonce>
<!-- Removed-->
</wsse:Nonce>
<wsu:Created>2017-07-07T20:35:22.041Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
<To d4p1:mustUnderstand="1" xmlns:d4p1="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">https://pc/Service/Service.svc</To>
<Action d4p1:mustUnderstand="1" xmlns:d4p1="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">Service/Service/GetVersion</Action>
</MessageHeaders>
トレース(CF2016/Axisはリクエストや結果に窒息されている場合イムわからない) - 私はそれが「チャネルを介してメッセージを受信したことを確認することができ、セキュリティプロトコルがメッセージを確認し、メッセージが読まれます私はGetVersionの実行をTo/fromにしてから、送信メッセージが表示されます。メッセージの受信時に軸が失敗する可能性はありますか?
テストエンドポイント#wsurl#はテストできますか? – ah7866
残念ながら、すべてがローカルにホストされていません。 @ ah7866 –