【问题标题】:Yaws SOAP client Content-TypeYaws SOAP 客户端内容类型
【发布时间】:2013-04-04 14:03:19
【问题描述】:

我在 Tomcat 上部署了一个示例 Spring-WS WebService。我可以使用 Java 客户端成功调用它,但是当我尝试使用 Yaws 客户端时:

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

我得到一个服务器端异常:

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
(...)

当我比较 Java 和 Yaws HTTP 请求时,第一个具有“Content-Type:text/xml;charset=utf-8”,而第二个:“Content-Type: application/xml;charset=utf- 8"。但是,在 yaws_soap_lib.erl 源文件中,内容类型似乎是硬编码的:

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)}.

当我将其更改为“text/xml”并重新编译时,Yaws 客户端工作正常。

有没有办法让客户端在不改变源代码的情况下工作?

我可以附加 WSDL 和请求/响应内容,但我认为这里没有必要。

【问题讨论】:

    标签: web-services erlang spring-ws webservices-client yaws


    【解决方案1】:

    我不认为有,你为什么不在 github project's page 上提交错误报告?或者,最好提供一个补丁。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-21
      • 2018-07-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-10
      相关资源
      最近更新 更多