Axis: createCall with parameters

I generated java code with wsdl2java based on Magento WSDL ( http: // host / api? Wsdl ), but cannot call any procedure with parameters

Environment:

  • Jdk 1.8
  • Axis 1.4
  • php 5.6
  • Magento 1.6

Problem:

For example, product.info requires the api method of 2 parameters: sessionId and productId

code:

 MagentoService magentoService = new MagentoServiceLocator(); Mage_Api_Model_Server_HandlerBindingStub service = new Mage_Api_Model_Server_HandlerBindingStub(new URL("http://myhost/api"), magentoService); String sessionId = service.login("api-user", "AAAAAAAAAAAAAAAA"); Call serviceCall = service.createCall(); serviceCall.setOperationName(new QName("call")); serviceCall.setTargetEndpointAddress(new URL("http://myhost/api")); serviceCall.addParameter("sessionId", Constants.XSD_STRING, ParameterMode.IN); serviceCall.addParameter("resourcePath", Constants.XSD_STRING, ParameterMode.IN); serviceCall.addParameter("productId", Constants.XSD_STRING, ParameterMode.IN); serviceCall.setReturnType(Constants.SOAP_MAP); serviceCall.invoke("call", new Object[] {sessionId, "product.info", new Object[]{2115}}); 

i proven database, the product really exists. no matter what identifier was used, I get an error:

 AxisFault faultCode: 101 faultString: Product not exists. 

I am trying to use other api methods like customer.info and have the same result.

how to pass parameters correctly?

What I've done:

+5
source share
1 answer

Magento documentation is faulty: http://www.magentocommerce.com/api/soap/catalog/catalogProduct/catalog_product.info.html

The parameter "productId" is actually called the "product".

+3
source

Source: https://habr.com/ru/post/1244558/


All Articles