0

I would like to log my request and response. I found a very easy solution to do so by changing the properties recommended here: Tracing XML request/responses with JAX-WS

My problem is, that I do not want to log credentials, so I manually need to adapt the log-message.

I am new to soap so I have not much experience at all.

I use a gradle plugin to create java classes of my WSDL: https://plugins.gradle.org/plugin/no.nils.wsdl2java

My code to create a service:

import javax.xml.namespace.QName
import javax.xml.ws.Service
[...]

private MYSoapWsdlClass createClient(String url) {

    URL serverEndpoint = new URL(url)
    QName SERVICE_NAME = new QName("DOC_URL", "SERVICE_NAME")
    Service service = Service.create(serverEndpoint, SERVICE_NAME)
    return service.getPort(MYSoapWsdlClass.class)
}

So how could I get the logging handler in here? Or is there another easy way to instantiate my service using the wsdl? Usually I use groovy, but could not find a wsdl2groovy plugin.

Many thanks

Ruth
  • 856
  • 2
  • 13
  • 26

1 Answers1

0

We now use org.apache.cxf

It was a bit tricky to figure it out at first, but then it does provide a very nice way to add features - including a logging feature.

The Service is created int he spring config:

  public static final LoggingFeature LOGGING_FEATURE = new LoggingFeature(outSender: new CustomEventOutSender(),
                                                                      inSender: new CustomEventInSender(),
                                                                      limit: -1)

@Bean
MYSoapWsdlClass mYSoapWsdlClass() {
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(serviceClass: MYSoapWsdlClass.class,
                                                          address: url,
                                                          features: [LOGGING_FEATURE]
    )
    return factory.create()
}
Ruth
  • 856
  • 2
  • 13
  • 26