For example, the client is a dispatch client like this:
Code: Select all
SOAPMessage response = dispatch.invoke(request); //where the request is a SOAP request
Moderators: Site Manager, fjwalraven
Code: Select all
SOAPMessage response = dispatch.invoke(request); //where the request is a SOAP request
With Holder<T> types this works a bit different. In fact the types show up in the types section of the WSDL.Since add is a void method, the response is always empty according to the WSDL and schema. So, if the dispatch client receives the response as a SOAPMessage, the client won't see any output.
Code: Select all
<xs:schema xmlns:tns="http://ws.notes.nl/" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0" targetNamespace="http://ws.notes.nl/">
<xs:element name="getMathResult" type="tns:getMathResult"/>
<xs:element name="getMathResultResponse" type="tns:getMathResultResponse"/>
<xs:complexType name="getMathResult">
<xs:sequence>
<xs:element name="arg0" type="xs:int"/>
<xs:element name="arg1" type="xs:int" minOccurs="0"/>
<xs:element name="arg2" type="xs:int" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="getMathResultResponse">
<xs:sequence>
<xs:element name="arg1" type="xs:int" minOccurs="0"/>
<xs:element name="arg2" type="xs:int" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
Code: Select all
//Schema from the WDSL
<xs:schema version="1.0" targetNamespace="http://InOutEx/">
<xs:element name="getMathResult" type="tns:getMathResult"/>
<xs:element name="getMathResultResponse" type="tns:getMathResultResponse"/><xs:complexType name="getMathResult">
<xs:sequence>
<xs:element name="arg0" type="xs:int"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="getMathResultResponse">
<xs:sequence>
<xs:element name="arg1" type="xs:int" minOccurs="0"/>
<xs:element name="arg2" type="xs:int" minOccurs="0"/>
<xs:element name="arg3" type="xs:int" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
Code: Select all
<xs:schema version="1.0" targetNamespace="http://InOutEx/">
<xs:element name="getMathResult" type="tns:getMathResult"/>
<xs:element name="getMathResultResponse" type="tns:getMathResultResponse"/><xs:complexType name="getMathResult">
<xs:sequence>
<xs:element name="arg0" type="xs:int"/>
<xs:element name="arg1" type="xs:int" minOccurs="0"/>
<xs:element name="arg2" type="xs:int" minOccurs="0"/>
<xs:element name="arg3" type="xs:int" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="getMathResultResponse">
<xs:sequence>
<xs:element name="arg1" type="xs:int" minOccurs="0"/>
<xs:element name="arg2" type="xs:int" minOccurs="0"/>
<xs:element name="arg3" type="xs:int" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
Can you please stick to the number of parameters (3) otherwise other people reading this thread might get confused.The proxy client is the same, taking 4 parameters.
Code: Select all
public class MathServiceClient {
public static void main(String[] args) {
MathServiceImplService service = new MathServiceImplService();
MathService endpoint = service.getMathServiceImplPort();
// initialize Holder objects final Holder<Integer> m = new Holder<Integer>(null);
final Holder<Integer> n = new Holder<Integer>(null);
final Holder<Integer> o = new Holder<Integer>(null);
final int inputNumber=4; endpoint.getMathResult(inputNumber,m,n,o);
System.out.println("maths for number: " + inputNumber);
System.out.println("square: " + m.value);
System.out.println("volume: " + n.value);
System.out.println("factorial: " + o.value); } }
Yes, it is an example that works. Just try it yourself and read something about the Holder parameter and its use.Expalaination of this question has below sample client
is this client correct ? i
With four parameters:in all the explainations I read so far , is that get Port method cant be without parameters . How come getMathServiceImplPort() is getting invoked then ?
Code: Select all
endpoint.getMathResult(inputNumber,m,n,o);
Code: Select all
MathService endpoint = service.getMathServiceImplPort();
Code: Select all
MathService endpoint = service.getMathServiceImplPort(MathService .class);
Code: Select all
//Only relevant part shown
@WebServiceClient(name = "MathServiceImplService"....)
public class MathServiceImplService extends Service
{
@WebEndpoint(name = "MathServiceImplPort")
public MathService getMathServiceImplPort() {
....
}
@WebEndpoint(name = "MathServiceImplPort")
public MathService getMathServiceImplPort(WebServiceFeature... features) {
...
}
}
Als verify the version of wsimport/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.1.6 in JDK 6
* Generated source version: 2.1
*
*/
Regards,wsimport -version
JAX-WS RI 2.1.6 in JDK 6
Users browsing this forum: No registered users and 76 guests