+ Start a Discussion
pradsy90pradsy90 

WSDL File address

How do i get the WSDL File address for the WSDL file for my custom APEX Class. I am trying to use a web based Generic SOAP Client and it needs a WSDL File address.

 

I previously used SOAP UI which required me to physically download the WSDL File and then place it on a local drive from where SOAP UI could read it.

imutsavimutsav

I am not sure but still you can try this.

 

In the application navigate to Your Name | Setup | Develop | Apex Classes.

Click the name of a class that containswebServicemethods.

Click Generate WSDL

 

 

search for the tag : <soap:address location='https://______________________' />

copy the address in the location this should be the address of the soap.

pradsy90pradsy90

Hi. Thanks... But no this does not work. The website says its an invalid WSDL address.

 

I suspect we cant get to the WSDL unless we have authenticated ourselves with our credentials..

imutsavimutsav

I guess you are right. I have always downloaded the wsdl file and have then used axis WSDL2Java to convert the WSDL to Java. http://axis.apache.org/axis/java/user-guide.html#WSDL2JavaBuildingStubsSkeletonsAndDataTypesFromWSDL.

pradsy90pradsy90

Hi -

 

Great segway. I have tried using the api docs avbl to get my APEX Class converted into a jar file using WC22 utility and have not had great success.

 

Now, I am seriously looking at WSDL2Java with the enterprise wsdl and my custom apex wsdl to be able to generate a java client that I can use. Can you please help me?

 

Do you have good documents or cookbooks you can point me to? Can we have a chat over the phone or something??

 

Regards,

Pradhip. S

imutsavimutsav

Sure send me your phone no. at Utsav.Srivastava@ymail.com. In the mean time this code might help you. Download the partner WSDL. Download and istall Axis on your computer and have to set the environment variables for it. Then you would conver the WSDL to Java using the command line Axis tool. Once you have the java code imort it into eclipse and then add the external jar file of Axis to the project. Now you should be able to use the code something like this.

 

public class WebserviceTest {

       /**
       * @param args
       */
       public void createRepPayFile(Date date) {
              // TODO Auto-generated method stub
              Properties props = null;
              SoapBindingStub binding = null;
              LoginResult loginResult = null;
              try {

                     //First use the username and password directly instead of properties file.
                     props = new Properties();
                     props.load(new FileInputStream("./config.properties"));
                     String userName = props.getProperty("userName");
                     String password = props.getProperty("password");
                     System.out.println("Properties file found");   
                     binding = (SoapBindingStub) new SforceServiceLocator().getSoap();
                     System.out.println("LOGGING IN NOW....");
                     loginResult = binding.login(userName, password);//Instead of using the propertis file you can also use the username and password directly hear
                     System.out.println("session Id: " + loginResult.getSessionId());
                     SessionHeader sh = new SessionHeader();
                     sh.setSessionId(loginResult.getSessionId());
                     System.out.println("Session Header is set");
                     XYZPageGeneratorBindingStub stub = (XYZPageGeneratorBindingStub)new XYZPageGeneratorServiceLocator().getXYZPageGenerator();
                     stub.setHeader(new XYZRepPageGeneratorServiceLocator().getServiceName().getNamespaceURI(),
                                  "SessionHeader", sh);
                     XYZGeneratorWrapper resultArr = stub.getOrders(date); //Call the method with the stub


                     if(resultArr!=null){
                           System.out.println("Resultset is not null.........");
                          try {
                         } catch (IOException e) {
                            System.out.println(e);
                         }
                     } else {
                           System.out.println("No records found");
                     }
              } catch (Exception ex) {
                     System.out.println("There is some issues in Creating the connection");
                     ex.printStackTrace();
              }
       }