1

I've got a sample Spring-WS WebService deployed on Tomcat. I can successfully call it with a Java client, but when I'm trying to use a Yaws client:

Wsdl = yaws_soap_lib:initModel("http://localhost:8080/EncryptionService/holiday.wsdl").
yaws_soap_lib:call(Wsdl, "Holiday", [], [{'p:HolidayRequest', [], "aaa"}]).

I get a server-side exception:

org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [spring-ws] in context with path [/EncryptionService] threw exception [Request processing failed; nested exception is org.springframework.ws.soap.SoapMessageCreationException: Could not create message from InputStream: Invalid Content-Type:application/xml. Is this an error message instead of a SOAP response?; nested exception is com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:application/xml. Is this an error message instead of a SOAP response?] with root cause
com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:application/xml. Is this an error message instead of a SOAP response?
        at com.sun.xml.internal.messaging.saaj.soap.MessageImpl.identifyContentType(MessageImpl.java:602)
        at com.sun.xml.internal.messaging.saaj.soap.MessageImpl.<init>(MessageImpl.java:275)
        at com.sun.xml.internal.messaging.saaj.soap.ver1_1.Message1_1Impl.<init>(Message1_1Impl.java:67)
        at
(...)

When I compared Java and Yaws HTTP requests, the first one has a "Content-Type: text/xml; charset=utf-8" while the second one: "Content-Type: application/xml; charset=utf-8". However, in yaws_soap_lib.erl source file, the content type seems to be hardcoded:

make_request_body(Content, []) ->
    {"application/xml; charset=utf-8",
     "<?xml version=\"1.0\" encoding=\"utf-8\"?>"++ Content};
make_request_body(Content, AttachedFiles) ->
    {"application/dime",
     yaws_dime:encode("<?xml version=\"1.0\" encoding=\"utf-8\"?>" ++ Content,
                      AttachedFiles)}.

When I changed that to "text/xml" and recompiled, the Yaws client works fine.

Is there a way to make the client work without changing the source code?

I can attach WSDL, and request/response content, but I don't think it's really necessary here.

Wacław Borowiec
  • 700
  • 1
  • 6
  • 12

1 Answers1

0

I don't think there is, why don't you file a bug report on the github project's page? Or maybe, even better provide a patch.

Carlo
  • 1,686
  • 3
  • 29
  • 43