我有一些webservice可以在axis2中的服務器上運行。如何用已經xml格式化的請求消息填充泡沫
我收到了一些xml數據,我們應該使用我們的webservice從第三方獲得這些數據。根據我們web服務的wsdl,xml數據格式良好。
以便測試我做的:
url = 'http://localhost:8080/axis2/services/{0}?wsdl'.format('myWebService')
print 'url=%s' % url
client = Client(url)
print client
with open("input.xml") as f:
inputXml = f.read()
print client.service.myWebserviceRequest(inputXml)
(在肥皂水中給出的axis2.py測試文件以下),我收到以下錯誤消息:據
urllib2.URLError: <urlopen error [Errno 10061] No connection could be made becau
se the target machine actively refused it>
我看到print Client
這個聲明,它是在等待不在xml窗體下的對象,而是在python窗體下。 (這就是axis.py代碼的其餘部分所暗示的)
但是在我的情況下,我已經在xml中創建了數據。你知道我怎麼可以直接輸入它作爲XML請求client.service.myWebserviceRequest
?
(它不是連接的一個問題,因爲我訪問該web服務的Axis2 getVersion
)
EDIT1:的print client statement
的輸出。
Service (myWebService) tns="ws.myCompany.com"
Prefixes (2)
ns2 = "myData.ws.myCompany.com"
ns3 = "ws.myCompany.com"
Ports (1):
(MyServiceSSOAP12port_http)
Methods (1):
sendMyInformation(ns2:DATA_HEADER DATA_HEADER, ns2:OTHER_CONTENT OTHER_CONTENT,)
Types (1):
WSExceptionType
令我百思不解的是,皁液客戶端暴露sendMyInformation((ns2:DATA_HEADER DATA_HEADER, ns2:OTHER_CONTENT OTHER_CONTENT,)
,而在我的WSDL提供的數據是形式的服務:
<xs:element name="WHOLE_CONTENT">
<xs:complexType>
<xs:sequence>
<xs:element ref="DATA_HEADER"/>
<xs:element ref="OTHER_CONTENT"/>
</xs:sequence>
</xs:complexType>
</xs:element>
您能顯示'print client'的輸出嗎? – dusan 2012-04-11 18:37:35
我已編輯並添加了信息。 – 2012-04-12 09:39:01
您應該調用'client.service.sendMyInformation'而不是'client.service.myWebserviceRequest'。但Suds期望有一個'DATA_HEADER'和一個'OTHER_CONTENT'對象,而不是你的'inputXml' ... – dusan 2012-04-12 12:42:47