我尝试调用身份服务器(对于Reckon API),这将向我发送一个HTML页面,我应该将用户名和密码传递给它以授权我,但在WSO2 ESB中显示以下消息:
SOAP消息绝不能包含文档类型声明(DTD)
我可以在ESB日志中看到html页面详细信息,但是。
Remaining input stream :[ </li> </ul> </div> </div> </div> </div> </div> <script id='modelJson' type='application/json'>{"loginUrl":"/login?signin=cdf07a3cb572cd62438b93ab5fa39b48","antiForgery":{"name":"idsrv.xsrf","value":"Fws6qKgkCal2HVkpciKAuvce-95kVOdD5W2gJUSYzKivHJctKWRdpxoJDQmsJMS2kR7yI8cdRrDHKYafWGNY7-iiGlulWkqPBHF8rUoJXfg"},"allowRememberMe":true,"rememberMe":false,"username":null,"externalProviders":[{"text":"Microsoft","href":"https://identity.reckon.com/external?provider=Microsoft&signin=cdf07a3cb572cd62438b93ab5fa39b48"},{"text":"Google","href":"https://identity.reckon.com/external?provider=Google&signin=cdf07a3cb572cd62438b93ab5fa39b48"}],"additionalLinks":null,"errorMessage":null,"requestId":"b07d58ce-9a48-448f-a665-31a40c08ae09","siteUrl":"https://identity.reckon.com/","siteName":"Reckon IdentityServer","currentUser":null,"logoutUrl":"https://identity.reckon.com/logout"}</script> <script src="/assets/scripts.js"></script> </body> </html> ]
和 错误:
org.apache.axis2.builder.BuilderUtil} - OMException in getSOAPBuilder org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createDTD(StAXSOAPModelBuilder.java:462) org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:282) org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:204) org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.(StAXSOAPModelBuilder.java:154) org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.(StAXSOAPModelBuilder.java:140) org.apache.axis2.builder.BuilderUtil.getSOAPBuilder(BuilderUtil.java:659) org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:206) org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:146) org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:109) org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:68) org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:348) org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:445) org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225) org.apache.axis2.client.OperationClient.execute(OperationClient.java:149) org.apache.synapse.message.senders.blocking.BlockingMsgSender.sendReceive(BlockingMsgSender.java:254) org.apache.synapse.message.senders.blocking.BlockingMsgSender.send(BlockingMsgSender.java:175) org.apache.synapse.mediators.builtin.CallMediator.handleBlockingCall(CallMediator.java:113) org.apache.synapse.mediators.builtin.CallMediator.mediate(CallMediator.java:85) org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:81) org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:48) org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:149) org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:175) org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:317) org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:149) org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) java.lang.Thread.run(Thread.java:748)
之前有人遇到过这个问题吗?
答案 0 :(得分:0)
在/repository/conf/axis2/axis2.xml中为conent-type text / xml(用于html内容)启用消息构建器和格式化程序
消息构建器
<messageBuilder contentType="text/html"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
邮件格式化程序
<messageFormatter contentType="text/html"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
答案 1 :(得分:0)
我找到了解决方案并将其发布给像我这样的其他人。 我们应该将内容类型text / javascript添加到axis2文件中。从日志中可以看出,响应是一个javascript。
<messageBuilder contentType="text/javascript"
class="org.apache.synapse.commons.json.JsonStreamBuilder"/>
<messageFormatter contentType="text/javascript"
class="org.apache.synapse.commons.json.JsonStreamFormatter"/>
希望这会对其他人有所帮助。