packet = head.process(packet, con.getWebServiceContextDelegate()
packet.transportBackChannel);
} catch(Exception e) {
(And then various calling to these methods:)
com.sun.xml.ws.api.message.MessageWrapper.readPayload()
com.sun.xml.ws.server.sei.EndpointArgumentsBuilder.readWrappedRequest(Message, Object[])
But, the packet (or JSONMessage) returned a "false" for its "hasPayload()". The reason why is because it is called inside here from the packet's "delegate.readPayload()"
It is called from
protected void readWrappedRequest(Message msg, Object[] args) throws JAXBException, XMLStreamException {
if (!msg.hasPayload()) {
throw new WebServiceException("No payload. Expecting payload with "+wrapperName+" element");
(BTW, the readPayload is called from inside here because JSONMessage is the delagate:)
public XMLStreamReader readPayload() {
try {
return delegate.readPayload();
} catch (XMLStreamException e) {
So, I changed that to return true, and it chokes because once it says it has a payload, it tries to read the payload as an XMLStreamReader, and the method in JSONMessage of course, returns null.
How would you suggest converting the JSON payload to an XMLStreamReader inside of the JSONMessage com.jaxws.json.JSONMessage.readPayload()?
--
You received this message because you are subscribed to the Google Groups "jsonwebservice" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jsonwebservic...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
if(style == Style.RPC){
WrapperComposite cs = new WrapperComposite();
//CompositeStructure cs = new CompositeStructure();
cs.values = parameterObjects;
cs.bridges = new XMLBridge[childParameters.size()];
for(ParameterImpl parameterChild : childParameters){
cs.bridges[parameterChild.getIndex()] = parameterChild.getXMLBridge();
}
obj = cs;
}else{
Class<?> type = (Class<?>)parameter.getBridge().getTypeReference().type;
obj = jsonPopulator.getNewInstance(type);
for(ParameterImpl parameterChild : childParameters){
type.getField(parameterChild.getPartName()).set(obj,
parameterObjects[parameterChild.getIndex()]);
}
}
System.err.println("\n\n\n PARAMETER GET XML BRIDGE -> " + parameter.getXMLBridge() + " obj= " + obj);
Message ret = JAXBMessage.create(parameter.getXMLBridge(), obj, this.codec.soapVersion);
System.err.println(" ret = " + ret);
return ret;
PARAMETER GET XML BRIDGE -> com.sun.xml.ws.db.glassfish.BridgeWrapper : com.sun.xml.bind.v2.runtime.BridgeImpl@719554e2 obj= com.sun.xml.ws.spi.db.WrapperComposite@79cf2f93
ret = com.sun.xml.ws.message.jaxb.JAXBMessage@5a34252a
message = decoder.getWSMessage();
public JavaCallInfo deserializeRequest(Packet req) {
com.sun.xml.ws.api.databinding.JavaCallInfo call = new com.sun.xml.ws.api.databinding.JavaCallInfo();
try {
JavaMethodImpl wsdlOp = resolveJavaMethod(req);
TieHandler tie = wsdlOpMap.get(wsdlOp);
call.setMethod(tie.getMethod());
Object[] args = tie.readRequest(req.getMessage());
call.setParameters(args);
} catch (DispatchException e) {
call.setException(e);
}
return call;
}
public Object[] readRequest(Message reqMsg) {
Object[] args = new Object[noOfArgs];
try {
argumentsBuilder.readRequest(reqMsg,args);
} catch (JAXBException e) {
throw new WebServiceException(e);
} catch (XMLStreamException e) {
throw new WebServiceException(e);
}
return args;
}
public void readRequest(Message msg, Object[] args) throws JAXBException, XMLStreamException {
readWrappedRequest(msg, args);
}
and the readWrappedRequest is exactly where the problem occurs. msg.hasPayload() will call the JSONMessage's hasPayload() which I changed to return true, and then chokes on msg.readPayload() which calls the JSONMessage's readPayload(). That is where I'm sort of stuck.
protected void readWrappedRequest(Message msg, Object[] args) throws JAXBException, XMLStreamException {
if (!msg.hasPayload()) {
throw new WebServiceException("No payload. Expecting payload with "+wrapperName+" element");
}
XMLStreamReader reader = msg.readPayload();
XMLStreamReaderUtil.verifyTag(reader,wrapperName);
reader.nextTag();
while(reader.getEventType()==XMLStreamReader.START_ELEMENT) {
// TODO: QName has a performance issue
QName name = reader.getName();
WrappedPartBuilder part = wrappedParts.get(name);
if(part==null) {
// no corresponding part found. ignore
XMLStreamReaderUtil.skipElement(reader);
reader.nextTag();
} else {
part.readRequest(args,reader, msg.getAttachments());
}
XMLStreamReader com.jaxws.json.JSONMessage.readPayload() throws XMLStreamException
Reads the payload as a XMLStreamReader This consumes the message. The caller is encouraged to call XMLStreamReaderFactory.recycle(XMLStreamReader) when finished using the instance.
Overrides: readPayload() in Message
Returns:
If there's no payload, this method returns null. Otherwise always non-null valid XMLStreamReader that points to the payload tag name.
Throws:
@SOAPBinding(style = SOAPBinding.Style.RPC)
@WebService (name="core.helpthehungry.com", targetNamespace="http://core.helpthehungry.com")
ERROR [http-bio-8080-exec-17] (WSServletDelegate.java:181) - caught throwable
java.lang.NullPointerException
at com.oracle.webservices.api.message.BasePropertySet.containsKey(BasePropertySet.java:406)
at com.oracle.webservices.api.message.BaseDistributedPropertySet.containsKey(BaseDistributedPropertySet.java:192)
at com.jaxws.json.codec.JSONCodec.decode(JSONCodec.java:482)
at com.sun.xml.ws.transport.http.HttpAdapter.decodePacket(HttpAdapter.java:347)
at com.sun.xml.ws.transport.http.HttpAdapter.invokeAsync(HttpAdapter.java:541)
} else if(content.startsWith("JSON=")){
2) In JSONCodec, right at the beginning of the method decode(), it is likely an Oracle bug, but the Packet.containsKey will access its "viewthis" parameter which is null for me at this point. And so, packet.get() and packet.supports() works, but there's a NPE on containsKey(). I guess that's why you had that wrapped in a try/catch before, because the type of Packet might throw that. Anywho, that was the cause of the null pointer exception that I spoke of in the earlier posttry {
if (jsonMap.containsKey("_")){
jsonMap.remove("_");
}
if(jsonMap.size() == 1){
"Your using form data. " + "Use your parameter as
Map : {getAppNotificationsUnreadCount={request={accessToken= aabbccddeeff1, fromType=User, version=2}}, _= 1392222222228}
It didn't use to do this in the older jsonwebservices, though. It is something "new". So, see how it took the last param and added to the hashmap? That ends up tricking it into thinking there are 2 operations, when really there's just the 1.
I hope this wasn't too long-winded. I am actually really happy with the results. It's definitely working with metro jaxws 2.3, and that's cause for celebration!! Awesome work, Sundar!