MaterialClient.java
1.18 KB
package com.huaheng.api.erp.client;
import com.huaheng.api.erp.client.material.TableOfZsmmWms005;
import com.huaheng.api.erp.client.material.ZsmmWms005;
import com.huaheng.common.exception.service.ServiceException;
import com.huaheng.framework.config.JaxWsDynamicClientFactory;
import org.apache.cxf.endpoint.Client;
import org.springframework.stereotype.Service;
import javax.xml.ws.Holder;
@Service
public class MaterialClient {
public String searchDetail(String materialCode){
JaxWsDynamicClientFactory jdcf = JaxWsDynamicClientFactory.newInstance();
Client client = jdcf.createClient("192.168.11.24:9090/ZmmWsWms003Service?wsdl");
TableOfZsmmWms005 materialList = new TableOfZsmmWms005();
ZsmmWms005 material = materialList.getItem().get(0);
material.setMatnr(materialCode);
Holder<TableOfZsmmWms005> result= new Holder<>(materialList);
try {
client.invoke("zmmfmWms003",result,result);
} catch (Exception e) {
throw new ServiceException("物料查询,回调erp接口错误");
}
ZsmmWms005 resultMaterial = result.value.getItem().get(0);
return resultMaterial.getMaktx();
}
}