apache synapse使用(2)
接着上面看官方的示例消息中介示例
1,本地注册项,可重复使用的端点和序列
0.1
客户端执行
ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/
可以看到输出的结果
Standard :: Stock price = $80.1611906447455
过程是先进入main然后直接进入可重用序列stockqnote,最后将请求的信息发送到http://localhost:9000/services/SimpleStockQuoteService
使用http://localhost:9000/services/SimpleStockQuoteService?wsdl可以看到显示的结果
2,错误处理
客户端执行
ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dsymbol=MSFT
执行查询MSFT的股价,因为没有对应的端点查找最接近的错误处理,服务端看到提示
INFO LogMediator text = An unexpected error occured, message = Couldn't find the endpoint with the key : bogus
执行查看sun的股价
ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dsymbol=SUN
最后打印出信息
INFO LogMediator text = An unexpected error occured for stock SUN, message = Couldn't find the endpoint with the key : sunPort
这个是在sunSeqence这个序列里执行的。
3,创建错误的SOAP信息并且变化消息的方向
客户端调用
ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dsymbol=MSFT
返回
soapenv:Client java.net.UnknownHostException: bogus
执行
ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dsymbol=SUN
返回
soapenv:Client java.net.ConnectException: Connection refused
4,操纵SOAP协议头,修改传入或传出的消息
修改协议头
客户端调用
ant stockquote -Dtrpurl=http://localhost:8280/
直接指向
http://localhost:9000/services/SimpleStockQuoteService
页:
[1]