boekhold
13 years agoNew Contributor
Missing operation for soapAction when using SAAJ attachment
Hi all,
I'm trying to develop a Web Service client that uses SAAJ and an application/pdf attachment to the WS operation call. The code basically looks like:
I'm testing against a Mock Service in SoapUI 4.5.1.
The above call works in case is==null. However as soon as I open an InputStream as:
then SoapUI fails with:
I've done a lot of googling on this, and none of the suggestions I found helped:
- Disable Mock HTTP Log
- ensure Require SOAP Action == false
Any suggestions? Is this supposed to be supported by SoapUI?
Maarten
I'm trying to develop a Web Service client that uses SAAJ and an application/pdf attachment to the WS operation call. The code basically looks like:
SOAPMessage msg = messageFactory.createMessage();
SOAPEnvelope env = msg.getSOAPPart().getEnvelope();
SOAPBody bdy = env.getBody();
env.addNamespaceDeclaration(NSPREFIX, NAMESPACE);
SOAPBodyElement op = bdy
.addBodyElement(name("AddDocumentWithContent"));
SOAPElement bussCode = op.addChildElement("arg0");
SOAPElement propVal = op.addChildElement("arg1");
SOAPElement mimeType = op.addChildElement("arg2");
bussCode.addTextNode(businessCode);
propVal.addTextNode(propValues);
mimeType.addTextNode(content.getMimeType());
// Attach our document
InputStream is = content.getData();
if (is != null) {
LOG.debug("attaching document of type {}", content.getMimeType());
AttachmentPart part = msg.createAttachmentPart();
// ByteArrayDataSource from javax.mail API
part.setDataHandler(
new DataHandler(
new ByteArrayDataSource(is, content.getMimeType())));
msg.addAttachmentPart(part);
}
msg.saveChanges();
SOAPMessage res = call(msg);
I'm testing against a Mock Service in SoapUI 4.5.1.
The above call works in case is==null. However as soon as I open an InputStream as:
new FileInputStream("C:/software/lib/apache-ant-1.7.0/docs/appendix_e.pdf");
then SoapUI fails with:
SoapUI Log:
Mon Mar 25 10:47:25 GST 2013:ERROR:An error occured [Missing operation for soapAction [] and body element [null] with SOAP Version [SOAP 1.1]], see error log for details
error log:
Mon Mar 25 10:47:26 GST 2013:ERROR:com.eviware.soapui.impl.wsdl.mock.DispatchException: Missing operation for soapAction [] and body element [null] with SOAP Version [SOAP 1.1]
com.eviware.soapui.impl.wsdl.mock.DispatchException: Missing operation for soapAction [] and body element [null] with SOAP Version [SOAP 1.1]
at com.eviware.soapui.impl.wsdl.mock.WsdlMockRunner.dispatchPostRequest(WsdlMockRunner.java:318)
at com.eviware.soapui.impl.wsdl.mock.WsdlMockRunner.dispatchRequest(WsdlMockRunner.java:375)
at com.eviware.soapui.monitor.JettyMockEngine$ServerHandler.handle(JettyMockEngine.java:715)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
...
I've done a lot of googling on this, and none of the suggestions I found helped:
- Disable Mock HTTP Log
- ensure Require SOAP Action == false
Any suggestions? Is this supposed to be supported by SoapUI?
Maarten