Hi Kathees,

Every object is salesforce is treated as a sobject. (Including Attachment)

Fields are listed in [1]. You need to create and send a payload similar to
[2]

Since there is already connector with create method, Just debug and check
the request send to api.

[1]
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_attachment.htm#topic-title

[2]

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
                    xmlns:urn="urn:partner.soap.sforce.com">
    <soapenv:Header />
    <soapenv:Body>
        <sfdc:sObjects xmlns:sfdc="urn:partner.soap.sforce.com"
xmlns:sfdc1="urn:sobject.partner.soap.sforce.com">
            <sfdc1:type>attachment</sfdc1:type>
    <sfdc1:Body>base64_content</sfdc1:Body>
            <sfdc1:ParentId>xxxxxxxxxxx</sfdc1:ParentId>
        </sfdc:sObjects
    </soapenv:Body>
</soapenv:Envelope>

Best Regards,
Malaka

On Thu, Dec 11, 2014 at 6:21 PM, Kathees Rajendram <[email protected]> wrote:
>
> Hi,
>
> I need to add the base64 encoding attachment to parent sObject in
> Salesforce. I used the following payload. Could you please suggest a way?
> We use the Salesforce partner WSDL.
>
> <payloadFactory>
>             <format>
>                 <soapenv:Envelope xmlns:soapenv="
> http://schemas.xmlsoap.org/soap/envelope/";
>                     xmlns:urn="urn:partner.soap.sforce.com">
>                     <soapenv:Header />
>                     <soapenv:Body>
>                         <urn:attachment>$1</urn:attachment>
>                     </soapenv:Body>
>                 </soapenv:Envelope>
>             </format>
>             <args>
> <property expression="get-property('attachmentObject')" />
>
> This is the base64 encoding attachment
>
> try {
>             Axis2MessageContext axisMsgContext = (Axis2MessageContext)
> synCtx;
>             org.apache.axis2.context.MessageContext msgContext =
> axisMsgContext
>                     .getAxis2MessageContext();
>             InputStream message = msgContext.attachments
>                     .getSOAPPartInputStream();
>             byte[] bytes = IOUtils.toByteArray(message);
>
>             String encoded = Base64.encode(bytes);
>
>             synCtx.setProperty("attachmentObject", encoded);
>
>         }
>
> Thanks,
> Kathees
>
> --
> Kathees
> Software Engineer,
> email: [email protected]
> mobile: +94772596173
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>

-- 

Best Regards,

Malaka Silva
Senior Tech Lead
M: +94 777 219 791
Tel : 94 11 214 5345
Fax :94 11 2145300
Skype : malaka.sampath.silva
LinkedIn : http://www.linkedin.com/pub/malaka-silva/6/33/77
Blog : http://mrmalakasilva.blogspot.com/

WSO2, Inc.
lean . enterprise . middleware
http://www.wso2.com/
http://www.wso2.com/about/team/malaka-silva/
<http://wso2.com/about/team/malaka-silva/>

Save a tree -Conserve nature & Save the world for your future. Print this
email only if it is absolutely necessary.
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to