1. 程式人生 > >wsdl檔案生成webservice的http和https的問題

wsdl檔案生成webservice的http和https的問題

我用gsoap生成的客戶端webservice為什麼沒有Envelope和Body元素

如下:

<?xml version="1.0" encoding="UTF-8"?>
<ns1:GetTime xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:c14n="http://www.w3.org/2001/10/xml-exc-c14n#" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" xmlns:wsc="http://schemas.xmlsoap.org/ws/2005/02/sc" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:ns1="http://marchnetworks.com/device_ws/">
</ns1:GetTime>
我希望需要這樣的
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<GetTime xmlns:d3p1="http://schemas.datacontract.org/2004/07/MarchNetworks.VideoSphere.Protocol.Agent" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://marchnetworks.com/device_ws/"/>
</s:Body>
</s:Envelope>

最後發現是wsdl檔案裡的一個元素做如下修改就可以達到目的

<soap:binding transport="http://schemas.xmlsoap.org/soap/https" /> 改為
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />

這應該是http 和https 的問題導致的,先做一個記錄,以後再深入瞭解一下