为什么SOAP请求obj数据从Spring发送到客户端的服务器为空

时间:2018-06-04 05:51:21

标签: java spring-boot soap soap-client

我正在尝试在SpringBoot maven项目中使用SOAP Webservices。所以我使用wsdl生成了类。我试图调用服务器,客户端能够命中服务器,但请求数据将作为null进入服务器。

我不知道为什么请求数据作为null进入服务器。请找到我的代码如下:

@PayloadRoot(namespace = Constants.NAMESPACE_URI, localPart = "StatementsList")
    @ResponsePayload
    public StatementsListResponse statementsListRequest(@RequestPayload StatementsList request) throws Exception {

        System.out.println("Enters into StatementsList()");

     //here is the Client call
        WSClient client = new WSClient();
        response = client.statementsListService(request.getXMLRequest());

        return response;
    }


@Component
public class WSClient extends WebServiceGatewaySupport{

   private ServicesSoapStub soapStub = null;

    @PostConstruct
    public void init() throws ServiceException {
        // will get invoked after all injections


        ServicesLocator sLocator = new ServicesLocator();
        ServicesSoapStub stub = (ServicesSoapStub) sLocator.getServicesSoap();

        soapStub = stub;
    }

  public  StatementsListResponse statementsListService(StatementsListRequest request)
            throws RemoteException, ServiceException {

            //Here i am able to print the request obj data and able to see the data as well.
        System.out.println("Enters into WSClient :: statementsListService()"); 


        return soapStub.statementsList(request);

    }
}

SOAP UI请求:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:prim="http://***/Services">
   <soapenv:Header/>
   <soapenv:Body>
      <prim:StatementsList>
         <!--Optional:-->
         <prim:XMLRequest>
            <!--Optional:-->
            <prim:Header>
               <!--Optional:-->
               <prim:MessageID>1</prim:MessageID>
               <!--Optional:-->
               <prim:CorrelationID>1</prim:CorrelationID>
               <!--Optional:-->
               <prim:SystemID>1</prim:SystemID>
               <!--Optional:-->
               <prim:RequestorID>1</prim:RequestorID>
               <!--Optional:-->
               <prim:InstitutionID>1</prim:InstitutionID>
            </prim:Header>
            <prim:Reference>A</prim:Reference>
            <!--Optional:-->
            <prim:Number>40000</prim:Number>
         </prim:XMLRequest>
      </prim:StatementsList>
   </soapenv:Body>
</soapenv:Envelope>

以上操作使用SOAP UI进行测试。并且我能够在上面的请求对象中打印从SOAP UI传递的请求obj的数据。

任何人都可以建议为什么请求将服务器作为null。这里有什么东西在做。请在此建议。

0 个答案:

没有答案