2012-06-24 138 views
2

我想使用javascript調用Web服務。我有一個表格,我給一些參數(INT),並希望得到結果如何使用JavaScript?JavaScript和Web服務WSDL

這裏是嘗試使用AJAX,使這個看http://www.ibm.com/developerworks/webservices/library/ws-wsajax/的教程中的WSDL文件

<definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://lapack.sws4hpsc.uth/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://lapack.sws4hpsc.uth/" name="DgesvSampleWsService"> 
<ns1:Policy xmlns:ns1="http://www.w3.org/ns/ws-policy" wsu:Id="DgesvSampleWsPortBinding_MTOM_Policy"> 
<ns1:ExactlyOne> 
<ns1:All> 
<ns2:OptimizedMimeSerialization xmlns:ns2="http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization" ns1:Optional="true"/> 
</ns1:All> 
</ns1:ExactlyOne> 
</ns1:Policy> 
<types> 
<xsd:schema> 
<xsd:import namespace="http://lapack.sws4hpsc.uth/" schemaLocation="http://83.212.96.238:8080/DgesvSampleWs/DgesvSampleWsService?xsd=1"/> 
</xsd:schema> 
</types> 
<message name="_dgesv"> 
<part name="parameters" element="tns:_dgesv"/> 
</message> 
<message name="_dgesvResponse"> 
<part name="parameters" element="tns:_dgesvResponse"/> 
</message> 
<portType name="DgesvSampleWs"> 
<operation name="_dgesv"> 
<input message="tns:_dgesv"/> 
<output message="tns:_dgesvResponse"/> 
</operation> 
</portType> 
<binding name="DgesvSampleWsPortBinding" type="tns:DgesvSampleWs"> 
<ns3:PolicyReference xmlns:ns3="http://www.w3.org/ns/ws-policy" URI="#DgesvSampleWsPortBinding_MTOM_Policy"/> 
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> 
<operation name="_dgesv"> 
<soap:operation soapAction=""/> 
<input> 
<soap:body use="literal"/> 
</input> 
<output> 
<soap:body use="literal"/> 
</output> 
</operation> 
</binding> 
<service name="DgesvSampleWsService"> 
<port name="DgesvSampleWsPort" binding="tns:DgesvSampleWsPortBinding"> 
<soap:address location="http://83.212.96.238:8080/DgesvSampleWs/DgesvSampleWsService"/> 
</port> 
</service> 
</definitions> 

,第二個

<definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://lapack.sws4hpsc.uth/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://lapack.sws4hpsc.uth/" name="DgtsvSampleWsService"> 
<ns1:Policy xmlns:ns1="http://www.w3.org/ns/ws-policy" wsu:Id="DgtsvSampleWsPortBinding_MTOM_Policy"> 
<ns1:ExactlyOne> 
<ns1:All> 
<ns2:OptimizedMimeSerialization xmlns:ns2="http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization" ns1:Optional="true"/> 
</ns1:All> 
</ns1:ExactlyOne> 
</ns1:Policy> 
<types> 
<xsd:schema> 
<xsd:import namespace="http://lapack.sws4hpsc.uth/" schemaLocation="http://83.212.96.238:8080/DgtsvSampleWs/DgtsvSampleWsService?xsd=1"/> 
</xsd:schema> 
</types> 
<message name="_dgtsv"> 
<part name="parameters" element="tns:_dgtsv"/> 
</message> 
<message name="_dgtsvResponse"> 
<part name="parameters" element="tns:_dgtsvResponse"/> 
</message> 
<portType name="DgtsvSampleWs"> 
<operation name="_dgtsv"> 
<input message="tns:_dgtsv"/> 
<output message="tns:_dgtsvResponse"/> 
</operation> 
</portType> 
<binding name="DgtsvSampleWsPortBinding" type="tns:DgtsvSampleWs"> 
<ns3:PolicyReference xmlns:ns3="http://www.w3.org/ns/ws-policy" URI="#DgtsvSampleWsPortBinding_MTOM_Policy"/> 
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> 
<operation name="_dgtsv"> 
<soap:operation soapAction=""/> 
<input> 
<soap:body use="literal"/> 
</input> 
<output> 
<soap:body use="literal"/> 
</output> 
</operation> 
</binding> 
<service name="DgtsvSampleWsService"> 
<port name="DgtsvSampleWsPort" binding="tns:DgtsvSampleWsPortBinding"> 
<soap:address location="http://83.212.96.238:8080/DgtsvSampleWs/DgtsvSampleWsService"/> 
</port> 
</service> 
</definitions> 

回答

1

+0

多數民衆贊成我所做的,我得到你好世界作爲一個結果這就是所有沒有數字 –

+0

在tut也說ws.js我在哪裏可以得到它? –

+0

它在下載的腳本文件中。 – itsme