微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

利用perl soap服务向.net、https服务端传送UserToken

服务端传送数据使用SSL加密    基于wsse2.0开发的.net webservice

soap xml:   

  message = qq{  <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/07/secext">  
        <soap:Header>
            <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soap:mustUnderstand="1">
                <wsse:UsernameToken>
                    <wsse:Username>u_name</wsse:Username>
                    <wsse:Password>u_pwd</wsse:Password>
                </wsse:UsernameToken>
            </wsse:Security>

          </soap:Header>       
          <soap:Body>
            ......
            </soap:Body>
        </soap:Envelope>};

 

my $userAgent = LWP::UserAgent->new();
    $userAgent->credentials('globusfamily.com:80','',$u_name,$u_pwd);
    my $request = HTTP::Request->new(POST => $vendor_url);

 

$request->authorization_basic('[email protected]','gotobus888');         $request->header(SOAPAction => 'http://www.globusfamily.com/api/booking/ws/internal/GVI_Booking');         $request->content($message);            $request->content_type("text/xml; charset=utf-8");            my $response = $userAgent->request($request);         #die $message;         if($response->code == 200) {                 my $return_xml = $response->as_string;                    $return_xml = JUtility->unescape_XML($return_xml);             $return_xml =~ s/&amp;/&/g;                    }         else         {             return "";         }   

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐