You need to sign in to do that
Don't have an account?
datvikash
raw request xml for upsert operation on enterprise wsdl
I am implementing a soap client in java utilizing jaxb and spring webservices so I don't have to build out the various stub files for the wsdl. I have been successful with login() and getServerTimestamp(). I am now looking at the upsert(). The request body for the upsert() is as follows (retrieved this using soapUI). I understand the sessionHeader and the resetting of the service endpoint after login, however I am not clear on how to insert the sObjects based on this request outline. Currently I would only be using the wsdl to upsert personAccounts. Could someone provide me an example of a raw xml request that would upsert personAccounts or any sObject?
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com" xmlns:urn1="urn:sobject.enterprise.soap.sforce.com"> <soapenv:Header> <urn:EmailHeader> <urn:triggerAutoResponseEmail>?</urn:triggerAutoResponseEmail> <urn:triggerOtherEmail>?</urn:triggerOtherEmail> <urn:triggerUserEmail>?</urn:triggerUserEmail> </urn:EmailHeader> <urn:PackageVersionHeader> <!--Zero or more repetitions:--> <urn:packageVersions> <urn:majorNumber>?</urn:majorNumber> <urn:minorNumber>?</urn:minorNumber> <urn:namespace>?</urn:namespace> </urn:packageVersions> </urn:PackageVersionHeader> <urn:DebuggingHeader> <urn:debugLevel>?</urn:debugLevel> </urn:DebuggingHeader> <urn:AllOrNoneHeader> <urn:allOrNone>?</urn:allOrNone> </urn:AllOrNoneHeader> <urn:DisableFeedTrackingHeader> <urn:disableFeedTracking>?</urn:disableFeedTracking> </urn:DisableFeedTrackingHeader> <urn:AllowFieldTruncationHeader> <urn:allowFieldTruncation>?</urn:allowFieldTruncation> </urn:AllowFieldTruncationHeader> <urn:MruHeader> <urn:updateMru>?</urn:updateMru> </urn:MruHeader> <urn:AssignmentRuleHeader> <urn:assignmentRuleId>?</urn:assignmentRuleId> <urn:useDefaultRule>?</urn:useDefaultRule> </urn:AssignmentRuleHeader> <urn:SessionHeader> <urn:sessionId>?</urn:sessionId> </urn:SessionHeader> </soapenv:Header> <soapenv:Body> <urn:upsert> <urn:externalIDFieldName>?</urn:externalIDFieldName> <!--Zero or more repetitions:--> <urn:sObjects> <!--Zero or more repetitions:--> <urn1:fieldsToNull>?</urn1:fieldsToNull> <urn1:Id>?</urn1:Id> </urn:sObjects> </urn:upsert> </soapenv:Body> </soapenv:Envelope>
I would suggest that the easiest way to generate the client classes for Salesforce Web Services for Java is to follow the guide below:
http://wiki.developerforce.com/index.php/Introduction_to_the_Force.com_Web_Services_Connector
Basically you generate the WSDL via the API -> Generate WSDL functions. You use that WSDL and generate your client classes.
I've done this many times for JEE applications and its very easy and gives you a client JAR you can include in your EAR/WAR.
Your upsert code would look like this:
SoapBindingStub binding = (SoapBindingStub) new SforceServiceLocator().getSoap();
binding.upsert("ExternalID1", opptys);
Also - You'll have more luck with this type of request int the Java Development board. as it relates to Java and SF Integration.
Some examples http://wiki.developerforce.com/index.php/Sample_SOAP_Messages