无法将数据发布到SOAP服务:HTTP状态404请求的资源()不可用

时间:2015-11-10 18:59:29

标签: python web-services soap

我试图通过HTTPS将数据发送到SOAP服务,但是肯定会卡住......响应始终是" HTTP状态404请求的资源()不可用"

wsdl文件:https://wstest.gosign.lt/unisign/service/onesignservice.wsdl

请告诉我它有什么问题。

我的代码(python):

 xml="""<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ones="https://wstest.gosign.lt/unisign/service/onesignservice.wsdl">
        <soapenv:Header/>
        <soapenv:Body>
            <ones:InitOneSignRequest xmlns="https://wstest.gosign.lt/unisign/service/onesignservice.wsdl">
         <ones:clientInfo>
            <!--clientId>TESTID</clientId-->
            <!--Optional:-->
            <signerPersonalCode>777777777</signerPersonalCode>
            <!--Optional:-->
            <locale>lt</locale>
            <responseUrl>http://some_url</responseUrl>
            <!--Optional:-->
            <remoteAddress></remoteAddress>
            <!--0 to 2 repetitions:-->
            <acceptableInfrastructure></acceptableInfrastructure>
         </ones:clientInfo>
         <!--Optional:-->
         <ones:signatureMetadata>
            <!--Optional:-->
            <reason></reason>
            <!--Optional:-->
            <location></location>
            <!--Optional:-->
            <contact></contact>
         </ones:signatureMetadata>
         <!--Optional:-->
         <ones:signatureDisplayProperties>
            <!--Optional:-->
            <position></position>
            <!--Optional:-->
            <displayValidity></displayValidity>
            <!--Optional:-->
            <signatureImageUrl></signatureImageUrl>
            <!--Optional:-->
            <backgroundImageUrl></backgroundImageUrl>
         </ones:signatureDisplayProperties>
         <!--Optional:-->
         <ones:mobileSigningText></ones:mobileSigningText>
         <ones:signingType>Signature</ones:signingType><ones:file>
            <fileDigest>cid:502841313118</fileDigest>
            <!--Optional:-->
            <fileName>somename</fileName>
            <content>cid:1348553326218</content>
         </ones:file>
         <ones:signature>cid:1279381531143</ones:signature>
      </ones:InitOneSignRequest>
   </soapenv:Body>
</soapenv:Envelope>
        """


protocol=ssl.PROTOCOL_TLSv1_2
ssl_context=ssl.SSLContext(protocol)
conn = httplib.HTTPSConnection('wstest.gosign.lt', context=ssl_context)
conn.connect()
conn.putrequest("POST", "https://wstest.gosign.lt/unisign/service/OneSignService/InitSigning; HTTP/1.1")
conn.putheader("SOAPAction", "https://wstest.gosign.lt/unisign/service/OneSignService/InitSigning")
conn.putheader("Content-Type", "text/xml; charset=utf-8" )
conn.putheader("Content-Length", len(xml))
conn.endheaders()
conn.send(xml)
response = conn.getresponse()
print(response.read())

0 个答案:

没有答案