Quantcast
Channel: SCN : All Content - Process Integration (PI) & SOA Middleware
Viewing all articles
Browse latest Browse all 7030

Consume a PI webservice in Java class

$
0
0


Hi Experts,

 

I need to comsume a Webservice given by PI in Java class.

Here is what i did:

 

1. PI person gave me a WSDL file test.wsdl

2. Axis I converted WSDL to stubs or Java classes

3. Stored the WSDL in a particular path on my PC

3. wrote a Java class to invoke this in Eclipse.

 

         QName SERVICE = new QName("https://xyz.com/XI/xyz_LOCAL/SCM", "MI_InboundWSService");

       

         URL url = null;

         try {

             url = new URL("file:/C:/out/MI_InboundWS.wsdl");

         } catch (MalformedURLException e) {

             java.util.logging.Logger.getLogger(MIInboundWSService.class.getName())

                 .log(java.util.logging.Level.INFO,

                      "Can not initialize the default wsdl from {0}", "file:/C:/out/MI_InboundWS.wsdl");

         }

        

        

        

         //MIInboundWSService service = new MIInboundWSService(url);    

             

         Service service = Service.create(url, SERVICE);

        

         MIInboundWS client = service.getPort(MIInboundWS.class);   

             

         DTSampleWS mtSampleWs = new DTSampleWS();

        

         mtSampleWs.setInput1("test by Vaibhav !!");

        

         client.miInboundWS(mtSampleWs);  

 

 

This is working, PI is able to get this data.

 

The issue is, WSDL is created in Development PI server with target link as below in the WSDL:

 

<soap:address location="http://server:50400/XISOAPAdapter/MessageServlet?channel=:DS3_SAP_Sourcing:DS3_SAP_Sourcing_SOAP_Sender_VendorCreate&amp;version=3.0&amp;Sender.Service=DS3_SAP_Sourcing&amp;Interface=http%3A%2F%2Fxyz.com%2Fxi%2Fxyz_GLOBAL%2FSCM%2FSCSRCINT181%5EMI_VendorCreate_OUT_A" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>

 

So now for Quality and Prod, PI has to again create a seperate WSDL with respective target link in it.

As if you see in the code we are using WSDL and WSDL has Development link hardcoded.

 

Is there any way we can use a generic WSDL and pass the target link explicity ? or How can we manage in Quality and Prod without developing new WSDL.

 

Thanks a ton.


Viewing all articles
Browse latest Browse all 7030

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>