When I generate a stub (using Eclipse Oxygen, top-down, Axis1), the function are generated like these:
public TokenNamespace.ideas.mace.TokenResponse getToken(TokenNamespace.ideas.mace.TokenRequest tokenRequest) throws java.rmi.RemoteException {
return null;
}
public TokenNamespace.ideas.mace.TokenResponse getToken2(TokenNamespace.ideas.mace.TokenRequest tokenRequest, boolean stopOnAnyError, TokenNamespace.ideas.mace.EACommand[] command, TokenNamespace.ideas.mace.HttpHeader[] httpHeader) throws java.rmi.RemoteException {
return null;
}
Why is TokenRequest class kept intact, while BatchCommand and HttpHeaders are dismantled?
I tried adding more sub-elements under HttpHeaders and BatchCommand, but they just get split up as additional parameters. I can't spot any difference between their declarations and getToken's.
If you are talking about getToken2()
method then actually they are not dismantled rather if you see httpheaders
is actually an array of httpheader
so in java code it is converted to an array of httpheaders as parameter to getToken2
and same is the case for the CommandBatch
.
And
If you are talking about why they are dismantled from getToken() method then the solution is as given below.
This is because in the wsdl file you have not defined the parameters for getToken() method
For example you have this
<portType name="TokenService">
<operation name="getToken" parameterOrder="getToken">
<input message="tns:TokenService_getToken" />
<output message="tns:TokenService_getTokenResponse" />
</operation>
<operation name="getToken2" parameterOrder="getToken batchCommand httpHeaders">
<input message="tns:TokenService_getToken2" />
<output message="tns:TokenService_getTokenResponse" />
</operation>
</portType>
You should update it like below
<portType name="TokenService">
<operation name="getToken" parameterOrder="getToken batchCommand httpHeaders">
<input message="tns:TokenService_getToken" />
<output message="tns:TokenService_getTokenResponse" />
</operation>
<operation name="getToken2" parameterOrder="getToken batchCommand httpHeaders">
<input message="tns:TokenService_getToken2" />
<output message="tns:TokenService_getTokenResponse" />
</operation>
</portType>
That is your operation getToken should define the required parameters in the parameterOrder attribute.
And also change the message from
<message name="TokenService_getToken">
<part element="tns:httpHeaders" name="httpHeaders" />
</message>
to
<message name="TokenService_getToken">
<part element="tns:getToken" name="getToken" />
<part element="tns:batchCommand" name="batchCommand" />
<part element="tns:httpHeaders" name="httpHeaders" />
</message>
After that it generates the code correctly.
You can further take a look at this answer It is explaining how maxOccurs attribute is used. If it is not specified then an element will occur only once. So that is why getToken has not been changed into an array like the other parameters and rather replaced by the one occurrence of the TokenRequest which is indeed what is contained within getToken complexType. That is a single occurrence of TokenRequest
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With