私は、RPCエンコードを使用して昔ながらの設計のWebサービスを使用しています。
私の問題はXMLタイプに関連しているようです。
WSDLのメソッド:
<message name="WsPublic_DHT_GetData1Request">
<part name="ALogin" type="xs:string" />
<part name="Aid" type="xs:int" />
<part name="ARow" type="xs:int" />
<part name="ADt" type="xs:dateTime" />
<part name="ADt2" type="xs:dateTime" />
<part name="Afilter" type="xs:string" />
</message>
ご覧のとおり、xs:typesを使用しています。
それでは、Javaクライアントでどのように呼び出すかを見てみましょう。
Object[] argmts = {"USER=PASSWORD", 15089, 10, "2012-02-16 00:00", "2012-02-16 20:01", ""};
Object lsVal = call.invoke(argmts);
Aloginは、「=」で区切られたログイン+パスワードで構成されます。私はすでにこのWebサービスをvbsスクリプトでテストしましたが、動作します。
問題は、実行時にWebサービスが私を返し続けることです:lsVal = Error_login
私が使用するクレデンシャルは問題ないので、JavaのStringからxs:stringへの変換が悪いと思います。呼び出しのパラメーターを手動で定義しようとしましたが、XSDタイプしか見つかりませんでした。同じError_login回答が返されました。何かを逃したのではないかと思います。誰かが私を説明できますか?
これが完全な.javaです
package com.verallia.testapp;
import javax.xml.namespace.QName;
import javax.xml.rpc.Call;
import javax.xml.rpc.Service;
import javax.xml.rpc.ServiceFactory;
import javax.xml.rpc.encoding.XMLType;
public class JavaApplication1 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
try {
// create the Service client object
// using the wsdl and his service name
QName serviceName = new QName(
"IWS_VMS_PUBLIC_DHTservice",
"VisualManagerWS");
ServiceFactory factory = ServiceFactory.newInstance();
Service service = factory.createService(serviceName);
// Call object
Call call = service.createCall();
// operation name
QName operationName = new QName(
"http://10.153.14.29:1024/wsdl/IWS_VMS_PUBLIC_DHT", "WsPublic_DHT_GetData");
call.setOperationName(operationName);
QName portName = new QName(
"IWS_VMS_PUBLIC_DHTPort","IWS_VMS_PUBLIC_DHTPort");
call.setPortTypeName(portName);
// setting return type
call.setReturnType(XMLType.XSD_STRING, String.class);
// specify the RPC-style operation.
call.setProperty(Call.OPERATION_STYLE_PROPERTY,
"rpc");
// and the encoding style
call.setProperty(
Call.ENCODINGSTYLE_URI_PROPERTY,
"http://schemas.xmlsoap.org/soap/encoding/");
// the target endpoint
call.setTargetEndpointAddress(
"http://10.153.14.29:1024/soap/IWS_VMS_PUBLIC_DHT");
//call.
// Invoke the method
Object[] myArgs = {"WS_TALEND=TALEND", 15089, 10, "2012-02-16 00:00", "2012-02-16 20:01", ""};
for (Object o : myArgs)
{
System.out.println(o.toString());
}
Object lsVal = call.invoke(myArgs);
System.out.println("Returned XML String : " + lsVal.toString());
} catch (Throwable th) {
th.printStackTrace();
}
}
}