0

I have a web service with Spring and CXF like:

@Service
@WebService(serviceName = "ReceiveMultiFromVOfficeImpl")
@RequiredArgsConstructor
public class ReceiveMultiFromVOfficeImpl {

  public Long returnSignReult(ResultObj resultObj) {
    log.info("Start receive from Voffice...");
    return 0L;
  }
}

and my ws-endpoint-lazy-load.xml file config:

<?xml version="1.0" encoding="UTF-8"?>
 <beans xmlns="http://www.springframework.org/schema/beans">
   <bean class="com.abc.fw.ws.CxfWsEndpointFactory">
     <property name="endpoints">
        <list>
            <value>com.abc.bccs2.service.TestCustomService</value>
            <value>com.abc.voffice.vo.ReceiveMultiFromVOfficeImpl</value>
        </list>
    </property>
 </bean>
</beans>

When I call http://localhost:8082/services/pbh/ReceiveMultiFromVOfficeImpl?wsdl, it works and I can call SOAP. But when I call http://localhost:8082/services/pbh/ReceiveMultiFromVOfficeImpl, I expected it will show the endpoint's information. It shows error:

 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <soap:Fault>
            <faultcode>soap:Server</faultcode>
            <faultstring>Fault occurred while processing.</faultstring>
        </soap:Fault>
    </soap:Body>
</soap:Envelope>

What I want is something like: enter image description here How do I fix that?

NAM
  • 107
  • 3
  • 10

1 Answers1

1

I'm not sure you understand how a SOAP web service works, so here is some explanation about what you are seeing when accessing those URLs.

When dealing with a SOAP web service there is only one endpoint address to use to send messages to the web service and it is invoked over POST.

In your case:

POST http://localhost:8082/services/pbh/ReceiveMultiFromVOfficeImpl

is how you invoke the web service. As long as the web service is running and listening on that address, then a POST with a SOAP message will invoke the web service.

Because a SOAP web service can be described by a WSDL document, there must be some way to obtain the WSDL for the web service. By convention, it is accessible over a GET request at the web service endpoint by specifying a ?wsdl parameter.

In your case:

GET http://localhost:8082/services/pbh/ReceiveMultiFromVOfficeImpl?wsdl

will return the WSDL of the web service.

Any other GET/POST/URL comination will either return an error or will return some other information provided for convenience, assuming the web service framework used to build the web service does that. For example, this web service (http://www.dneonline.com/calculator.asmx) allows you to call its endpoint over GET and will return a human readable summary of what the WSDL accessible at (http://www.dneonline.com/calculator.asmx?wsdl) contains, but don't expect that to be the case with every framework out there (from what I remember CXF just returns an error if you call the web service endpoint over GET without a ?wsdl parameter).

So, to recap, the HTTP verbs and URLs valid for your web service are:

POST http://localhost:8082/services/pbh/ReceiveMultiFromVOfficeImpl -> to invoke the service
GET http://localhost:8082/services/pbh/ReceiveMultiFromVOfficeImpl?wsdl -> to obtain the service WSDL

Some other resources to read:

Finally, if you are using the proper URL and HTTP verb combination and you are getting that error, note that Fault occurred while processing is a generic error message that may show some issue with the web service code. Maybe there is a NullPointerException or some other error in your web service code. You need to look in your web service logs or in your web service console to see if there are any other exception messages or stacktrace that points to a root cause for that fault message.

Bogdan
  • 23,890
  • 3
  • 69
  • 61
  • Thanks for your helpful answer, but I still confuse a bit. I have supplemented image describe what I need to my question, hope you reread about it. – NAM May 12 '21 at 01:48
  • Why do you need that page? What is the purpose of it? Who is it for? – Bogdan May 12 '21 at 07:46
  • I actually dont need that page. I have to expose webservice and register link wsdl of my service to the existed service and it will call to my service (this service will call my webservice). I try to make all things compatible but it still can not call my webservice properly. I dont know what is wrong, so i just try to ensure my service do everything properly. – NAM May 13 '21 at 10:11
  • javax.xml.ws.WebServiceException: {http://vo.voffice.abc.com/}ReceiveMultiFromVOfficeImpl_Service is not a valid service. Valid services are: {http://vo.voffice.abc.com/}ReceiveMultiFromVOfficeImplService – NAM May 13 '21 at 10:11
  • Finally, I have got the log of client from partner when thay register my service like above. The problem seem to be service name, not involve to my question. – NAM May 13 '21 at 10:13