简体   繁体   English

Mule ESB:连接到https服务

[英]Mule ESB: Connect to https service

Can someone show me a small example of how to create a mule flow to send requests to a https service? 有人可以向我展示一个如何创建create流向HTTPS服务发送请求的小例子吗? I tried to do it, but I get the following errors: 我尝试这样做,但是出现以下错误:

INFO 2012-09-21 21:40:40,980 [[myapp_kareo].connector.http.mule.default.receiver.02] org.mule.transport.http.transformers.ObjectToHttpClientMethodRequest: Content-Type not set on outgoing request, defaulting to: text/plain
WARN 2012-09-21 21:40:41,081 [[myapp_kareo].connector.http.mule.default.receiver.02] org.mule.transformer.simple.ObjectToString: Could not close stream
java.io.IOException: Stream closed
at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:145)
at java.io.BufferedInputStream.read(BufferedInputStream.java:308) at org.apache.commons.httpclient.ContentLengthInputStream.read(ContentLengthInputStream.java:170)

etc... 等等...

I see at least 2 strange things: 我至少看到2件奇怪的事情:

  • org.mule.transport.http.transformers.ObjectToHttpClientMethodRequest : Content-Type not set on outgoing request, defaulting to: text/plain - I don't know from where I get this, the content type is set on all endpoints to text/xml. org.mule.transport.http.transformers.ObjectToHttpClientMethodRequest :未在传出请求上设置Content-Type,默认为:text / plain-我不知道从哪里获得的内容类型在所有端点上都设置为text / xml。
  • org.mule.transformer.simple.ObjectToString : Could not close stream - I cannot explain where this comes from... org.mule.transformer.simple.ObjectToString :无法关闭流-我无法解释其来源...

My xml configuration: 我的xml配置:

<?xml version="1.0" encoding="UTF-8"?>
<https:connector name="HTTP_HTTPS" cookieSpec="netscape" validateConnections="true" sendBufferSize="0" receiveBufferSize="0" receiveBacklog="0" clientSoTimeout="10000" serverSoTimeout="10000" socketSoLinger="0" proxyHostname="localhost" proxyPort="80" doc:name="HTTP\HTTPS">
    <https:tls-key-store path="/src/main/app/keystore/javakeystore.jks" storePassword="somepassword"/>
</https:connector>
<flow name="KareoFlow1" doc:name="KareoFlow1">
    <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="kareo" contentType="text/xml" doc:name="SomeApp"/>
    <https:outbound-endpoint exchange-pattern="request-response" host="webservice.kareo.com/" port="443" path="services/soap/2.1/KareoServices.svc" connector-ref="HTTP_HTTPS" contentType="text/xml" doc:name="Kareo"/>
    <echo-component doc:name="Echo"/>
</flow>

Thank you very much! 非常感谢你!

This gentlemen seems to of solved his own issue of setting up a https service. 这位先生似乎解决了自己设置https服务的问题。 Perhaps extracting some information from his example can guide you. 也许从他的例子中提取一些信息可以指导您。 He had a different error, as for your stream errors I want to say the port is closed. 他有一个不同的错误,关于您的流错误,我想说该端口已关闭。

http://forum.mulesoft.org/mulesoft/topics/https_connector_working_example_wanted http://forum.mulesoft.org/mulesoft/topics/https_connector_working_example_wanted

Including your mule configuration would let others help you more. 包括您的m子配置将使其他人为您提供更多帮助。

A simple example of sending request to HTTPS will be as follows :- 将请求发送到HTTPS的简单示例如下:-

<https:connector name="httpsBSConnector" doc:name="HTTP\HTTPS" clientSoTimeout="10000" cookieSpec="netscape" proxyHostname="proxy-nc.abc.com" proxyPort="80" receiveBacklog="0" receiveBufferSize="0" sendBufferSize="0" serverSoTimeout="10000" socketSoLinger="0" validateConnections="true">
     <https:tls-key-store path="${keystore.path}" keyPassword="${keystore.password}" storePassword="${keystore.password}"/>
     <https:tls-server path="${truststore.path}" storePassword="${truststore.password}"/>
</https:connector>

<https:outbound-endpoint address="https://${url}:${port}${path}" doc:name="getDataCall" exchange-pattern="request-response" method="POST" connector-ref="httpsBSConnector" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM