1
我正在開發一個java客戶端,我需要發送一些soap xml到服務器。服務器正在http方案上運行,但它需要像在https的情況下那樣對請求進行加密。我在我的服務器上生成了.cer和.key文件,並且在服務器端也導入了相同的文件。現在當我嘗試執行下面的命令向服務器發送請求時,它不起作用。與.key和.cer沒有https方案的HTTP請求
我SOAP XML是那裏的text.txt
curl -vX POST -d @test.txt http://test.com:98/wcflib-tc/service.svc
--header "Content-Type:application/soap+xml; charset=utf-8;"
--cert /myserver/certs/server.crt
--key /myserver/certs/server.key
* About to connect() to test.com port 98 (#0)
* Trying 172.27.655.65... connected
* Connected to test.com (172.27.655.65) port 98 (#0)
> POST /wcflib-tc/service.svc HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.12.9.0 zlib/1.2.3 libidn/1.18 libssh2/1.2.2
> Host: test.com:98
> Accept: */*
> Content-Type:application/soap+xml; charset=utf-8;
> Content-Length: 962
>
< HTTP/1.1 500 Internal Server Error
< Content-Type: application/soap+xml; charset=utf-8
< Server: Microsoft-IIS/7.0
< X-Powered-By: Programmer's tears
< Date: Mon, 18 Nov 2013 05:26:18 GMT
< Content-Length: 576
<
* Connection #0 to host test.com left intact
* Closing connection #0
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header><a:Action s:mustUnderstand="1">http://www.w3.org/2005/08/addressing/soap/fault</a:Action></s:Header>
<s:Body><s:Fault><s:Code><s:Value>s:Sender</s:Value>
<s:Subcode><s:Value xmlns:a="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
a:InvalidSecurity</s:Value></s:Subcode></s:Code>
<s:Reason><s:Text xml:lang="en-US">
An error occurred when verifying security
for the message.</s:Text></s:Reason>
請讓我知道解決的辦法。否則讓我知道如何處理使用任何Java API的.key和.cer文件的http請求。