Here you can find the source of createAttachmentPart(String cid, DataHandler dh, SOAPMessage message)
Parameter | Description |
---|---|
cid | String content id |
dh | DataHandler |
message | SOAPMessage |
public static AttachmentPart createAttachmentPart(String cid, DataHandler dh, SOAPMessage message)
//package com.java2s; /*/*w w w . j a va2 s . co m*/ * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import javax.activation.DataHandler; import javax.xml.soap.AttachmentPart; import javax.xml.soap.SOAPMessage; public class Main { /** * Create an SAAJ AttachmentPart from a JAXWS Attachment * @param cid String content id * @param dh DataHandler * @param message SOAPMessage * @return AttachmentPart */ public static AttachmentPart createAttachmentPart(String cid, DataHandler dh, SOAPMessage message) { // Create the Attachment Part AttachmentPart ap = message.createAttachmentPart(dh); // REVIEW // Do we need to copy the content type from the datahandler ? // Preserve the original content id ap.setContentId(cid); return ap; } }