简体   繁体   中英

SOAP Client Stub Class issue in Spring Boot

I am consuming SOAP Web Services in Spring Boot project. I am able to hit the server but the request is going to the server as null.

As i am not getting what is the wrong. before sending request to server and i am able to print the data in console by using logger.

and also is there any possibility to print xml format of request in java before calling server?

Please find the below Stub generated method:

 public UserListResponse UserList(UserListRequest XMLRequest) throws java.rmi.RemoteException {
        if (super.cachedEndpoint == null) {
            throw new org.apache.axis.NoEndPointException();
        }
        org.apache.axis.client.Call _call = createCall();
        _call.setOperation(_operations[14]);
        _call.setUseSOAPAction(true);
        _call.setSOAPActionURI("http://...../...Services/UserList");
        //_call.setProperty(org.apache.axis.client.Call.CHARACTER_SET_ENCODING,"UTF-8"); 
        _call.setEncodingStyle(null);
        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
        _call.setOperationName(new javax.xml.namespace.QName("http://...../...Services", "UserList"));

        setRequestHeaders(_call);
        setAttachments(_call);

        System.out.println("1 XMLRequest :: message ID ::STUB::"+XMLRequest.getHeader().toString());


 try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {XMLRequest});



        if (_resp instanceof java.rmi.RemoteException) {
            throw (java.rmi.RemoteException)_resp;
        }
        else {
            extractAttachments(_call);
            try {
                return (UserListResponse) _resp;
            } catch (java.lang.Exception _exception) {
                return (UserListResponse) org.apache.axis.utils.JavaUtils.convert(_resp, UserListResponse.class);
            }
        }
  } catch (org.apache.axis.AxisFault axisFaultException) {
  throw axisFaultException;
}
    }

SOAP UI request as below:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:prim="http://..../..Services">
   <soapenv:Header/>
   <soapenv:Body>
      <prim:UserList>
         <!--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>2</prim:InstitutionID>
            </prim:Header>
            <prim:Reference>Card</prim:Reference>
            <!--Optional:-->
            <prim:Number>500</prim:Number>
            <!--Optional:-->
            <prim:count>800</prim:count>
         </prim:XMLRequest>
      </prim:UserList>
   </soapenv:Body>
</soapenv:Envelope>

Can anyone please help on this.

Use below property in your application.yml or properties file .it will print the request XML and response XML

log4j.logger.org.springframework.ws.client.MessageTracing.sent=TRACE log4j.logger.org.springframework.ws.client.MessageTracing.received=TRACE

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM