WebService默认uri java.lang.IllegalArgumentException:' uri'不能为空

时间:2016-08-02 06:55:15

标签: java spring web-services soap

我正在使用Spring WebServiceTemplate& amp;下面是bean创建和我的bean类,但不知道为什么我无法获得Default Uri的值。 有人可以帮忙解决这个问题。

ServiceContext.java

        @Bean
    public Jaxb2Marshaller marshaller() {
        Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
        marshaller.setContextPath("com.canaldigital.tsi.schema.psd.psd_managecustomer.v2");        
        return marshaller;
    }


    @Bean
    public SaajSoapMessageFactory messageFactory() {
    SaajSoapMessageFactory factory=new SaajSoapMessageFactory();

    factory.setSoapVersion(SoapVersion.SOAP_12);
        return factory;
    }    

     @Bean
    public ManageService voucherService(Jaxb2Marshaller marshaller,SaajSoapMessageFactory messageFactory) {
         ManageService service = new ManageService();

        service.setDefaultUri("http://localhost:7001/CustomerService?WSDL");
        service.setMarshaller(marshaller);
        service.setUnmarshaller(marshaller);
        service.setMessageFactory(messageFactory);
        return service;
    }

ManageService.java

    public class ManageService extends WebServiceGatewaySupport {

    try{

    System.out.println("Finalyy calllingggg service: "+getWebServiceTemplate());    
    System.out.println("WebService template URI is: ---- "+getWebServiceTemplate().getDefaultUri());


    JAXBElement<GetCustomerInfoRequestType> mustangRequst=new createGetCustomerInfoRequest(customer);


     (JAXBElement<GetCustomerInfoResponseType>) getWebServiceTemplate().marshalSendAndReceive(mustangRequst);


    }catch(Exception e){

        e.printStackTrace();

         }

    }

2 个答案:

答案 0 :(得分:0)

当您调用扩展WebServiceGatewaySupport的客户端时,应使用@Autowired

答案 1 :(得分:0)

检查服务上没有@Service批注。