/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
*
* <p>
* This class mainly performs the following two tasks:
* <ol>
* <li>Takes a {@link Message] that represents a request,
* and extracts the arguments (and updates {@link Holder}s.)
* <li>Accepts return value and {@link Holder} arguments for a Java method,
* and creates {@link JAXBMessage} that represents a response message.
* </ol>
*
* <h2>Creating {@link JAXBMessage}</h2>
* <p>
* At the construction time, we prepare {@link EndpointArgumentsBuilder} that knows how to create endpoint {@link Method}
* invocation arguments.
* we also prepare {@link EndpointResponseMessageBuilder} and {@link MessageFiller}s
* that know how to move arguments into a {@link Message}.
* Some arguments go to the payload, some go to headers, still others go to attachments.
*
* @author Jitendra Kotamraju
*/
final class EndpointMethodHandler {
private final int noOfArgs;
// Converts {@link Message} --> Object[]
// these objects together create a response message from method parameters
this.javaMethodModel = method;
}
/**
* It builds EndpointArgumentsBuilder which converts request {@link Message} to endpoint method's invocation
* arguments Object[]
*
* @return EndpointArgumentsBuilder
*/
case BODY:
if(param.isWrapperStyle()) {
else
} else {
}
break;
case HEADER:
break;
case ATTACHMENT:
break;
case UNBOUND:
break;
default:
throw new AssertionError();
}
}
// creates {@link Holder} arguments for OUT parameters
if (param.isWrapperStyle()) {
for (ParameterImpl p : children) {
}
}
}
}
case 0:
break;
case 1:
break;
default:
}
return argsBuilder;
}
/**
* prepare objects for creating response {@link Message}
*/
case BODY:
if(param.isWrapperStyle()) {
} else {
}
} else {
}
break;
case HEADER:
break;
case ATTACHMENT:
break;
case UNBOUND:
break;
default:
throw new AssertionError(); // impossible
}
}
if (bodyBuilder == null) {
// no parameter binds to body. we create an empty message
switch(soapVersion) {
case SOAP_11:
break;
case SOAP_12:
break;
default:
throw new AssertionError();
}
}
return bodyBuilder;
}
try {
} catch (JAXBException e) {
throw new WebServiceException(e);
} catch (XMLStreamException e) {
throw new WebServiceException(e);
}
// Some transports(like HTTP) may want to send response before envoking endpoint method
// Doing this here so that after closing the response stream, cannot read
// request from some transports(light weight http server)
}
try {
} catch (InvocationTargetException e) {
// Service specific exception
} else {
if (cause instanceof ProtocolException) {
// Application code may be throwing it intentionally
} else {
// Probably some bug in application code
}
}
} catch (Exception e) {
}
return req.createServerResponse(responseMessage, req.endpoint.getPort(), javaMethodModel.getOwner(), req.endpoint.getBinding());
}
/**
* Creates a response {@link JAXBMessage} from method arguments, return value
*
* @return response message
*/
return msg;
}
}