jueves, 9 de diciembre de 2021

[JD Edwards - BSSV] JD Edwards - Salesforce integration: Making proxy package JAVA with WSIMPORT tool

Hi friend,

Recently, I've done a JDE with Salesforce Cloud integration, through BSSV both inbound and outbound communication with Soap technology. Salesforce use Apex (Oracle Application Express) for integrations

Integración JDE - Salesforce



One of the main problems that I found was generate proxy client, the  Organization WSDL  has a lot of methods (this service is the principal , and it is used for all access related: login, logout, sessions, userinfo, etc), and besides that when trying to generate proxy client in JDeveloper 12c (12.2.1.3.0) it gave errors to namespaces conflicts.

So, I decided try alternate path, using JAVA wsimport tool, it tool from the file or IP WSDL will generate us a package java .jar with all classes and method services, it package we could import to a ower bssv project as external library and works comfortable.

You can look a lot of information about the use of it java tool:

https://docs.oracle.com/javase/7/docs/technotes/tools/share/wsimport.html

https://www.ibm.com/support/knowledgecenter/es/SSEQTP_9.0.5/com.ibm.websphere.base.doc/ae/twbs_jaxwsclientfromwsdl.html

https://www.ibm.com/support/knowledgecenter/es/SSEQTP_9.0.5/com.ibm.websphere.base.doc/ae/rwbs_wsimport.html

https://mkyong.com/webservices/jax-ws/jax-ws-wsimport-tool-example/

http://chuwiki.chuidiang.org/index.php?title=Ejemplo_sencillo_de_web_service_con_jax-ws


And more specific for Salesforce service:

https://stackoverflow.com/questions/2322953/jax-ws-adding-soap-headers

https://udby.com/archives/132

I recommend, java version it's the same for wsimport and JDeveloper configured for your JDE enviroment ( it can do directly with the java executable version in JDE machine or add java version path on the PATH operative system).


Execution example:

wsimport -b bindings.xjb -keep -B-XautoNameResolution -XadditionalHeaders -Xdebug OrganizationDEV.wsdl -clientjar SalesForceOrganizationDEVWSDLConnector.jar 

Donde

wsimport: java  command for class generation from wsdl

-b: specify link files jaxws/jaxb or additional schemes

bindings.xjb: link file or additional schemes

-keep: keep generated files 

-B-XautoNameResolution: JAXB instructions to automatically resolve names conflicts.

-XadditionalHeaders: generates header parameters in request methods

-Xdebug: print debug information

OrganizationDEV.wsdl: wsdl file with service information

-clientjar: make jar file with artifacts generated together WSDL metadata for call web service.

SalesForceOrganizationDEVWSDLConnector.jar: jar file will generate with all java class and wsdl to project import.

bindings.xjb file will depends from namespaces and transformations to do.

bindings.xjb

<?xml version="1.0" encoding="UTF-8"?>

<bindings

    wsdlLocation="wsdlcalidad.wsdl"

    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"

    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"

    xmlns:xsd="http://www.w3.org/2001/XMLSchema"

    xmlns="http://java.sun.com/xml/ns/jaxws">

    <bindings node="//xsd:schema[@targetNamespace='urn:sobject.enterprise.soap.sforce.com']">

      <jaxb:globalBindings generateElementProperty="false" underscoreBinding="asCharInWord"/>

    </bindings>

</bindings>


Other example:

<?xml version="1.0" encoding="UTF-8"?>

<bindings

    wsdlLocation="INTProducto_JDE.wsdl"

    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"

    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"

    xmlns:xsd="http://www.w3.org/2001/XMLSchema"

    xmlns="http://java.sun.com/xml/ns/jaxws">

    <bindings node="//xsd:schema[@targetNamespace='http://soap.sforce.com/schemas/class/INTProducto_JDE']">

      <jaxb:globalBindings generateElementProperty="false" underscoreBinding="asCharInWord"/>

  <jaxb:schemaBindings>

        <jaxb:nameXmlTransform>

          <jaxb:typeName suffix="Type" />

        </jaxb:nameXmlTransform>

      </jaxb:schemaBindings>

    </bindings>

    <bindings node="//xsd:schema[@targetNamespace='http://soap.sforce.com/schemas/class/INTResponse']">

      <jaxb:globalBindings generateElementProperty="false" underscoreBinding="asCharInWord"/>

  <jaxb:schemaBindings>

        <jaxb:nameXmlTransform>

          <jaxb:typeName suffix="Type" />

        </jaxb:nameXmlTransform>

      </jaxb:schemaBindings>

    </bindings>

    <enableWrapperStyle>false</enableWrapperStyle>

    <enableAsyncMapping>false</enableAsyncMapping>

</bindings>

And finally, you import jar file to project, adding libraries for deploy and start to use classes and method to call service.

I hope it is useful for you friend.

Best regards.