'how to use Service,ServiceLocator,portType,porttypeProxy and stub to create a java client

i have used axis web service client wizard + develop client slider for generating files as :

  • Mage_Api_Model_Server_HandlerBindingStub
  • Mage_Api_Model_Server_HandlerPortType
  • Mage_Api_Model_Server_HandlerPortTypeProxy
  • MagentoService
  • MagentoServiceLocator please look at my post

i am trying to make a client some thing like this:

package Magento;

  public class MyClient {  
public static void main(String[] args) {  
    try{  
        MagentoServiceLocator msl = new MagentoServiceLocator();  
        MagentoService ms = (MagentoService) msl.WHICH_METHOD_TO_CALL();  

        double product_list = ms.catalogProductList;  
        System.out.println("Product List: " + product_list);  

    } catch (Exception e) {
        e.printStackTrace();
    }
  }

}

any help i have tried to the best of mine but not getting which method should i call for accessing a php webservice method. any help?



Solution 1:[1]

Create a client for the given wsdl and try this:

WebServiceSoapBindingStub stub = new WebServiceSoapBindingStub();
stub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, wsdlUrl); 
WebService service = (WebService) stub;
service.authenticateUser(username,password); //service.yourservicename

More information that will help you.

http://www.codeproject.com/KB/java/edujini_webservice_java.aspx

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Leonel Sanches da Silva