VB菜鳥提問:如下問題怎么處理??
在VB中呼叫JAVA Web servise 的代碼
Private Sub Command1_Click()
Dim soap1 As New SoapClient30
soap1.MSSoapInit "http://127.0.0.1:8080/Demo/DemoPort?wsdl"
Dim re As String
re = soap1.sayHello("123")
MsgBox re
End Sub
執行時報錯如下:
實時錯誤:“-2147024809(80070057)”
Client : Incorrect number of parameters supplied for SOAP request HRESULT=0x80070057: 引數錯誤。
-Client : Unspecified client error. HRESULT=0x80070057:引數錯誤。
同樣的方法呼叫其它 web servise 沒有問題,如:
soap.MSSoapInit "http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl"
re = soap.getSupportProvince()
‘回傳成功
JAVA 中就一個類
public class Demo {
public String sayHello(String name) {
return name + ", hello!";
}
}
在Myeclipse8.5使用JAX-WS框架 自動生成wsdl(用JAVA 呼叫沒問題) 。
<?xml version="1.0" encoding="UTF-8" ?>
- <!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.3-hudson-390-.
-->
- <!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.3-hudson-390-.
-->
- <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://server/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://server/" name="DemoService">
- <types>
- <xsd:schema>
<xsd:import namespace="http://server/" schemaLocation="http://127.0.0.1:8080/Demo/DemoPort?xsd=1" />
</xsd:schema>
</types>
- <message name="sayHello">
<part name="parameters" element="tns:sayHello" />
</message>
- <message name="sayHelloResponse">
<part name="parameters" element="tns:sayHelloResponse" />
</message>
- <portType name="DemoDelegate">
- <operation name="sayHello">
<input message="tns:sayHello" />
<output message="tns:sayHelloResponse" />
</operation>
</portType>
- <binding name="DemoPortBinding" type="tns:DemoDelegate">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
- <operation name="sayHello">
<soap:operation soapAction="" />
- <input>
<soap:body use="literal" />
</input>
- <output>
<soap:body use="literal" />
</output>
</operation>
</binding>
- <service name="DemoService">
- <port name="DemoPort" binding="tns:DemoPortBinding">
<soap:address location="http://127.0.0.1:8080/Demo/DemoPort" />
</port>
</service>
</definitions>
uj5u.com熱心網友回復:
知道的請給我說說,講解一下。謝謝。uj5u.com熱心網友回復:
我去,沒人。只能換法了。。
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/95263.html
標籤:網絡編程
