|
Info Structure Listing 2. The AmazonSearchPort_Stub is the stub that is initialized with a handlerChain. The method is passed an AuthorRequest structure and returns a ProductInfo structure. public class AmazonSearchPort_Stub
extends com.sun.xml.rpc.client.StubBase
implements javapro.amazon.AmazonSearchPort {
public AmazonSearchPort_Stub(
HandlerChain handlerChain) {
super(handlerChain);
_setProperty(ENDPOINT_ADDRESS_PROPERTY,
"http://soap.amazon.com/onca/soap3");
}
public ProductInfo
authorSearchRequest(
AuthorRequest authorSearchRequest)
throws java.rmi.RemoteException {
try {
StreamingSenderState _state = _start(
_handlerChain);
InternalSOAPMessage _request =
_state.getRequest();
_request.setOperationCode(
AuthorSearchRequest_OPCODE);
AmazonSearchPort_AuthorSearchRequest_
RequestStruct
requestStruct =
new AmazonSearchPort_AuthorSearchRequest_
RequestStruct();
requestStruct.setAuthorSearchRequest(
authorSearchRequest);
SOAPBlockInfo _bodyBlock =
new SOAPBlockInfo(
ns1_AuthorSearchRequest_AuthorSearchRequest_
QNAME);
_bodyBlock.setValue
(requestStruct);
_bodyBlock.setSerializer(
ns1requestStruct_SOAPSerializer);
_request.setBody(_bodyBlock);
_state.getMessageContext().setProperty(
HttpClientTransport.HTTP_SOAPACTION_PROPERTY,
"http://soap.amazon.com");
_send((String) _getProperty(
ENDPOINT_ADDRESS_PROPERTY), _state);
AmazonSearchPort_AuthorSearchRequest_
ResponseStruct
responseStruct = null;
Object _responseObj = _state.getResponse().
getBody().getValue();
if (_responseObj instanceof
SOAPDeserializationState) {
responseStruct =(
AmazonSearchPort_AuthorSearchRequest_
ResponseStruct)
((SOAPDeserializationState)_responseObj).
getInstance();
} else {
responseStruct = (
AmazonSearchPort_AuthorSearchRequest_
ResponseStruct)
_responseObj;
}
return responseStruct.get_return();
} catch (RemoteException e) {
// let this one through unchanged
throw e;
} catch (JAXRPCException e) {
throw new RemoteException(e.getMessage(), e);
} catch (Exception e) {
if (e instanceof RuntimeException) {
throw (RuntimeException)e;
} else {
throw new RemoteException(e.getMessage(), e);
}
}
}
}
|