how to use return value of soap web service in soap client
I have an soap web service that has a method like
public WsResult doMyJob(String s, Information info);
when I generate a client out of the wsdl, in the client code my webservice's method becomes something like:
public Object doMyJob(String s, Object arg0);
The problem is that I want client to be able to implement/see my custom classes(WsResult and Information) without explicitly defining them in his code.
Is that even possible and if so how?
Thanks
edit:
<?xml version='1.0' encoding='UTF-8'?><wsdl:definitions name="SendSms" targetNamespace="http://webservice.aaa.bbb.com/" xmlns:ns1="http://webservice.aaa.bbb.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd=开发者_如何学JAVA"http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://webservice.aaa.bbb.com/" xmlns="http://webservice.aaa.bbb.com/" xmlns:tns="http://impl.webservice.aaa.bbb.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="registerScheduledSms" type="registerScheduledSms" />
<xsd:complexType name="registerScheduledSms">
<xsd:sequence>
<xsd:element minOccurs="0" name="arg0" type="xsd:string" />
<xsd:element minOccurs="0" name="arg1" /> **HERE THERE SHOULD BE xsd definition for my custom class**
<xsd:element minOccurs="0" name="arg2" /> **and here**
<xsd:element minOccurs="0" name="arg3" type="xsd:dateTime" />
</xsd:sequence>
</xsd:complexType>
<xsd:element name="registerScheduledSmsResponse" type="registerScheduledSmsResponse" />
<xsd:complexType name="registerScheduledSmsResponse">
<xsd:sequence>
<xsd:element minOccurs="0" name="return" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="registerScheduledSmsResponse">
<wsdl:part element="ns1:registerScheduledSmsResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="registerScheduledSms">
<wsdl:part element="ns1:registerScheduledSms" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="SendSms">
<wsdl:operation name="registerScheduledSms">
<wsdl:input message="ns1:registerScheduledSms" name="registerScheduledSms">
</wsdl:input>
<wsdl:output message="ns1:registerScheduledSmsResponse" name="registerScheduledSmsResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
</wsdl:definitions>
my service code
@WebService(endpointInterface = "com.bbb.aaa.webservice.SendSms")
public class SendSmsImpl implements SendSms {
private DbService dbService;
@Override
public WsResult registerScheduledSms(String applicationId,
ServiceAccount serviceAccount, Sms sms, Date scheduledDate) {
return dbService.addNewScheduledSms(applicationId, serviceAccount, sms, scheduledDate);
}
}
Yes, that's perfectly possible. Your soap client should generate all classes defined in the schema types on your WSDL. You are probable missing something on client generation.
It would help if you specify what are you using for client generation (AXIS, .NET, JAX-WS) and confirm that your WSDL contains schema definitions for WsResult
and Information
types.
精彩评论