1 | req_message = WSMessage(req_payload_string, {"to" :END_POINT}) |
1 2 | client = WSClient({}, LOG_FILE_NAME) res_message = client.request(req_message) |
1 | client = WSClient({"use_soap" : "true"}, LOG_FILE_NAME) |
1 2 3 4 5 6 7 8 9 10 11 | # REST with HTTP POST client = WSClient({ "to" : END_POINT, "http_method" : "POST", "use_soap" : "false"}, LOG_FILE_NAME) # REST with HTTP GET client = WSClient({ "to" : END_POINT, "http_method" : "GET", "use_soap" : "false"}, LOG_FILE_NAME) |
1 2 3 | req_message = WSMessage(req_payload_string, {"to" :END_POINT, "attachments" : {"myid1" : "first attachment", "myid2" : "second attachment"}}) |
1 2 3 4 5 | # send attachments binary optimized client = WSClient({"use_mtom" : "true"}) # send attachments binary non-optimized client = WSClient({"use_mtom" : "false"}) |
1 2 3 4 5 | req_message = WSMessage(req_payload_string, {"to" : "http://localhost/echo_service_addr/echo", "action" : "http://jython.wsf.wso2.org/samples/echoString"}) client = WSClient({"use_wsa" : "true"}) |
1 2 3 4 5 6 7 8 | req_message = WSMessage(req_payload_string, {"to" : "http://www.company.com/order_processing/process", "action" : "http://jython.wsf.wso2.org/samples/order", "from" : "http://www.company.com/order_placing/place", "reply_to" : "http://www.company.com/billing/bill", "fault_to" : "http://www.company.com/re_odering/order"}) client = WSClient({"use_wsa" : "true"}) |
1 2 3 4 5 6 7 8 | req_message = WSMessage(req_payload_string, {"to" : "http://localhost/samples/security_service/callback", "action" : "http://jython.axis2.org/samples/echoString"}) client = WSClient({"use_wsa" : "true", "policy" : "Policy_Path"}) res_message = client.request(req_message) |
1 2 | sh wsfjython.sh /home/heshan/wsf-jython/jython/ distribution/target/wsf-jython-SNAPSHOT-bin/samples/amazon.py |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | from org.wso2.wsf.jython.client import WSClient from org.wso2.wsf.jython.client import WSFault from org.wso2.wsf.jython.client import WSMessage req_payload_string = "<ItemSearch><Service>AWSECommerceService</Service> <SearchIndex>Books</SearchIndex> <AWSAccessKeyId>XXXXXXXXXXXXXXXXXXX</AWSAccessKeyId> <Operation>ItemSearch</Operation> <Keywords>sri lanka travel books</Keywords></ItemSearch>" LOG_FILE_NAME = "/home/heshan/IdeaProjects/MRclient/src/python_amazon.log" END_POINT = "http://webservices.amazon.com/onca/xml" try: client = WSClient({ "http_method" : "GET", "use_soap" : "false"}, LOG_FILE_NAME) req_message = WSMessage(req_payload_string, {"to" :END_POINT}) print " Sending OM : " , req_payload_string res_message = client.request(req_message) print " Response Message: " , res_message except WSFault, e: e.printStackTrace(); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <ItemSearchResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2005-10-05"> <OperationRequest> <HTTPHeaders><Header Name="UserAgent" Value="Axis2" /></HTTPHeaders> <RequestId>114HR356NB5H18RR5WNM</RequestId> <Arguments><Argument Name="SearchIndex" Value="Books" /> <Argument Name="Service" Value="AWSECommerceService" /> <Argument Name="Keywords" Value="sri lanka travel books" /> <Argument Name="Operation" Value="ItemSearch" /> <Argument Name="AWSAccessKeyId" Value="XXXXXXXXXXXXXXXXXXX" /> </Arguments><Errors><Error> <Code>AWS.InvalidParameterValue</Code> <Message>XXXXXXXXXXXXXXXXXXX is not a valid value for AWSAccessKeyId. Please change this value and retry your request.</Message> </Error></Errors> </OperationRequest> </ItemSearchResponse> |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |