Ok, further info. This is from a very similar webservice, only difference in this one is that it deals with JPEGs.
These are TCPmon captures. My Client (attachment output ommited): POST /MediationAttachPic HTTP/1.1 | Accept: text/xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 | Content-Type: multipart/related; | type="text/xml"; | boundary="----=_Part_1_17933220.1162911613951" | Content-Length: 4228 | SOAPAction: "" | Cache-Control: no-cache | Pragma: no-cache | User-Agent: Java/1.5.0_08 | Host: 127.0.0.1:8081 | Connection: keep-alive | | ------=_Part_1_17933220.1162911613951 | Content-Type: text/xml; charset=utf-8 | | <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:com.mediation"> | <SOAP-ENV:Body> | <urn:depositAttach> | <id_lote>1</id_lote> | <file_name>xml-pic</file_name> | </urn:depositAttach> | </SOAP-ENV:Body></SOAP-ENV:Envelope> | ------=_Part_1_17933220.1162911613951 | Content-Type: image/jpeg | Content-ID: <imgpart=5e62851c:10ec2ef030e:[EMAIL PROTECTED]> SOAPui (attachment output ommited): POST /MediationAttachPic HTTP/1.1 | SOAPAction: "" | Content-Type: multipart/related; | type="text/xml"; | start="<[EMAIL PROTECTED]>"; | boundary="----=_Part_0_26490427.1162911728786" | MIME-Version: 1.0 | User-Agent: Jakarta Commons-HttpClient/3.0.1 | Host: 127.0.0.1:8081 | Content-Length: 4381 | | | ------=_Part_0_26490427.1162911728786 | Content-Type: text/xml; charset=UTF-8 | Content-Transfer-Encoding: 8bit | Content-ID: <[EMAIL PROTECTED]> | <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:com.mediation"> | <soapenv:Header/> | <soapenv:Body> | <urn:depositAttach> | <id_lote>2</id_lote> | <file_name>xml_pic</file_name> | </urn:depositAttach> | </soapenv:Body> | </soapenv:Envelope> | ------=_Part_0_26490427.1162911728786 | Content-Type: image/jpeg | Content-Transfer-Encoding: binary | Content-ID: | <[EMAIL PROTECTED]> The main difference to me is this line, which I believe is the one causing errors: start="<[EMAIL PROTECTED]>"; How can I define this in my client? SAAJ_ATTACH_CLIENT | public class SAAJ_Attach_Client | { | public static final String NAMESPACE_URI = "com.mediation"; | public static final String PREFIX = "urn"; | public static final String METHOD = "depositAttach"; | public static final File attach = new File("xml-pic.jpg"); | public static final String WS_URI = "http://localhost:8081/MediationAttachPic"; | | public static void main(String[] args) | { | | try | { | MessageFactory msgFactory = MessageFactory.newInstance(); | SOAPMessage msg = msgFactory.createMessage(); | SOAPPart soapPart = msg.getSOAPPart(); | SOAPEnvelope soapEnvelope = soapPart.getEnvelope(); | | soapEnvelope.addNamespaceDeclaration(PREFIX,PREFIX+":"+NAMESPACE_URI); | | // for this tutorial web service, we don't have any headers, | // so detach the one we get for "free": | SOAPHeader soapHeader = soapEnvelope.getHeader(); | soapHeader.detachNode(); | | // to the body, add the document we want to send to the | // profile update web service: | SOAPBody body = msg.getSOAPBody(); | SOAPFactory soapFactory = SOAPFactory.newInstance(); | Name bodyName = soapFactory.createName(METHOD,PREFIX, ""); | SOAPBodyElement bodyElement = body.addBodyElement(bodyName); | | // add the "profileID" element: | Name profileIDParamName = soapFactory.createName("id_lote"); | SOAPElement profileID = bodyElement.addChildElement(profileIDParamName); | profileID.addTextNode("1"); | | // add the "profilePhotoRef" reference to the photo we will attach: | Name profilePhotoRefParamName = soapFactory.createName("file_name"); | SOAPElement profilePhotoRef = bodyElement.addChildElement(profilePhotoRefParamName); | | profilePhotoRef.addTextNode("xml-pic"); | | // get the image file and attach it: | AttachmentPart binaryAttachPart = null; | | FileDataSource binaryFds = new FileDataSource(attach); | DataHandler binaryFileHandler = new DataHandler(binaryFds); | binaryAttachPart = msg.createAttachmentPart(binaryFileHandler); | binaryAttachPart.setContentType("image/jpeg"); | | binaryAttachPart.setContentId("<imgpart="+ (new java.rmi.server.UID()).toString() + "@example.com>"); | msg.addAttachmentPart(binaryAttachPart); | | if (msg.saveRequired()) | { | msg.saveChanges(); | } | | // echo the document first: | System.out.println("\nAbout to send the following SOAPMessage:\n"); | msg.writeTo(System.out); | System.out.println("\nto endpoint URL " + WS_URI + "\n"); | | // ...then send it, and echo the response: | SOAPConnectionFactory soapConnFactory = SOAPConnectionFactory.newInstance(); | SOAPConnection soapConn = soapConnFactory.createConnection(); | SOAPMessage responseMsg = soapConn.call(msg, WS_URI); | System.out.println("\nGot the following SOAPMessage in response:\n"); | responseMsg.writeTo(System.out); | | // in real life, declare outside of block and close in finally | soapConn.close(); | } | catch (IOException ioe) | { | System.err.println("IOException writing SOAPMessage: '" + ioe.getMessage() + "'"); | } | catch (SOAPException se) | { | System.err.println("SOAPException: '" + se.getMessage() + "'"); | System.err.println(" Cause: '" + se.getCause().getClass().getName() + "': " + se.getCause().getMessage()); | } | | } | | public SAAJ_Attach_Client() | { | } | } View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3983789#3983789 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3983789 _______________________________________________ jboss-user mailing list [email protected] https://lists.jboss.org/mailman/listinfo/jboss-user
