When using Salesforce's SOAP API, generate client-side code from the wsdl file. https://developer.salesforce.com/page/Introduction_to_the_Force.com_Web_Services_Connector
When one program communicates with multiple SalesForce instances using SOAP API, client-side code is generated for each instance. At that time, it is an introduction of the method to prevent the package name from being duplicated.
Basically, it is good to refer to Force.com Web Service Connector (WSC). The method has been improved little by little, so check here for the latest method.
First, build the jar to generate the code from wsdl from the source of wsc.
git clone https://github.com/forcedotcom/wsc.git
mvn clean package -Dgpg.skip -DskipTests
If gpg authentication or testing fails, pass the parameters to skip as above.
If the build is successful, a jar called force-wsc-x.y.z-uber.jar
will be generated under target.
Log in to your SalesForce instance and go to the Settings> Development> API screen. There is a download link for the wsdl. There are various types, but for normal data exchange, Enterprise WSDL will not be a problem.
main in com.sforce.ws.tools.wsdlc.java I am generating code with a method. See here for what's in the system properties for tweaking.
To prefix the package:
java -Dpackage-prefix=XXX -jar target/force-wsc-x.y.z-uber.jar enterprise.wsdl enterprise-XXX.jar
The package structure is com.sforce.soap.enterprise.XXX. After that, if you refer to each generated jar as a separate library, you can handle client-side code of multiple instances.
Recommended Posts