aspose file tools*
The moose likes Web Services and the fly likes WSWS3192E: Error: return code:  ( 400 ) Bad Request when trying to invoked webservice Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "WSWS3192E: Error: return code:  ( 400 ) Bad Request when trying to invoked webservice" Watch "WSWS3192E: Error: return code:  ( 400 ) Bad Request when trying to invoked webservice" New topic
Author

WSWS3192E: Error: return code: ( 400 ) Bad Request when trying to invoked webservice

Bharatwaj Vedantham
Greenhorn

Joined: Jan 27, 2010
Posts: 2
Hi

I am getting the below error when i try to invoke a webservice. The webservice call works fine when i dont add the attachment part in the handleRequest().

I have replaced the asmx link and fault actor ip with some random string below.


[27/01/10 12:06:13:915 GMT] 00000048 HttpOutboundC E WSWS3514E: No HTTP response body is available from the connection for: http://xxx/abc/abc.asmx
[27/01/10 12:06:14:118 GMT] 00000048 PivotHandlerW W org.apache.commons.logging.impl.Jdk14Logger warn WSWS3734W: Warning: Exception caught from invocation to com.ibm.ws.webservices.engine.transport.http.HTTPSender:
WebServicesFault
faultCode: HTTP
faultString: ( 400 ) Bad Request
faultActor: http://xxx
faultDetail:
null: WSWS3192E: Error: return code: ( 400 ) Bad Request
.

( 400 ) Bad Request
at com.ibm.ws.webservices.engine.transport.http.HTTPSender.processStatusCode(HTTPSender.java:1104)
at com.ibm.ws.webservices.engine.transport.http.HTTPSender.invoke(HTTPSender.java:729)
at com.ibm.ws.webservices.engine.PivotHandlerWrapper.invoke(PivotHandlerWrapper.java:227)
at com.ibm.ws.webservices.engine.handlers.jaxrpc.JAXRPCHandler.invoke(JAXRPCHandler.java:152)
at com.ibm.ws.webservices.engine.PivotHandlerWrapper.invoke(PivotHandlerWrapper.java:227)
at com.ibm.ws.webservices.engine.PivotHandlerWrapper.invoke(PivotHandlerWrapper.java:227)
at com.ibm.ws.webservices.engine.WebServicesEngine.invoke(WebServicesEngine.java:332)
at com.


Please find below the code snippet. Could somebody please advice if I am missing to add something more to the message?

I am using JAX-RPC.

My main objective is to send a rtf as a part of the SOAPMessage (first commented piece code) but the MIME type does not seem to supported. The webservice expects the rtf as soap attachment and processes it. Could somebody also advice how to add word document to attachment part?

public boolean handleRequest(MessageContext messageContext){
if(LOG.isTraceEnabled()){
LOG.trace("Entered method - handleRequest");
}
SOAPMessageContext smc = (SOAPMessageContext) messageContext;
SOAPMessage msg = smc.getMessage();
SOAPPart part = msg.getSOAPPart();

try {

// Dig down into the message, locate or create header block.
SOAPEnvelope envelope = part.getEnvelope();

// Get or create a SOAP header, only one allowed per message
SOAPHeader header = msg.getSOAPHeader();
if (header == null) {
header = envelope.addHeader();
}

// Add Root Header for Trace Id
SOAPElement tiHeaderRoot = header.addChildElement(HEADER_ROOT,
HEADER_PREFIX, NS_URI);

// Add Child Header for Trace Id
SOAPElement tiHeaderElement = tiHeaderRoot.addChildElement(
TRACE_ID, HEADER_PREFIX, NS_URI);
tiHeaderElement.addTextNode(LogUtils.getTraceId());

//Add attachment part to the message
AttachmentPart attachmentPart = msg.createAttachmentPart();

if(LOG.isTraceEnabled()){
LOG.trace("Attachment content is" + getDocumentByteArray());
}

DataHandler dataHandler = new DataHandler(new String("abc"),"text/plain");
attachmentPart.setDataHandler(dataHandler);
msg.addAttachmentPart(attachmentPart);

// if (null != getDocumentByteArray()){
// attachmentPart.setContent(getDocumentByteArray(), application/msword");
// msg.addAttachmentPart(attachmentPart);
// }

// if (null != getDocumentByteArray()){
// attachmentPart.setContent("textplain", "text/plain");
// msg.addAttachmentPart(attachmentPart);
// }

} catch (SOAPException soapException) {
throw new RBSGSystemException(InterviewMessageKey.cc_46, soapException);
}
if(LOG.isTraceEnabled()){
LOG.trace("Exited method - handleRequest");
}
return super.handleRequest(messageContext);
}


Thanks
Bharat


 
It is sorta covered in the JavaRanch Style Guide.
 
subject: WSWS3192E: Error: return code: ( 400 ) Bad Request when trying to invoked webservice