我有下一个架构:
<xs:schema xmlns:tns="http://common.balance.contract.kernel.bgbilling.bitel.ru/" xmlns:ns1="http://common.bitel.ru" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0"targetNamespace="http://common.balance.contract.kernel.bgbilling .bitel.ru/">
<xs:import namespace="http://common.bitel.ru" s chemaLocation="http://xxx:8080/bgbilling/executer/ru.bitel.bgbilling.kernel.contract.balance/PaymentService?xsd=1"/>
<xs:element name="BGException" type="tns:BGException"/>
…
<xs:element name="paymentUpdate" type="tns:paymentUpdate"/>
<xs:element name="paymentUpdateResponse" type="tns:paymentUpdateResponse"/>
<xs:complexType name="BGException">
<xs:sequence>
<xs:element name="message" type="xs:string" minOccurs="0"/>
<xs:element name="tag" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="payment">
<xs:complexContent>
<xs:extension base="tns:abstractBalanceBean">
<xs:sequence/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="abstractBalanceBean" abstract="true">
<xs:complexContent>
<xs:extension base="ns1:id">
<xs:sequence>
<xs:element name="comment" type="xs:string" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="contractId" type="xs:int" use="required"/>
<xs:attribute name="date" type="xs:dateTime"/>
<xs:attribute name="sum" type="xs:decimal"/>
<xs:attribute name="summa" type="xs:decimal"/>
<xs:attribute name="timeChange" type="xs:dateTime"/>
<xs:attribute name="typeId" type="xs:int" use="required"/>
<xs:attribute name="userId" type="xs:int" use="required"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="paymentUpdate">
<xs:sequence>
<xs:element name="payment" type="tns:payment" minOccurs="0"/>
<xs:element name="distribution" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
请告诉我如何在方法paymentUpdate中发送参数(在Perl中)?
$client->call('paymentUpdate'=>SOAP::Data->type("namesp1:paymentUpdate")->...
写什么? 如何创建和发送所需类型(paymentUpdate)?
答案 0 :(得分:0)
使用属性,这是解决方案:
$wsdl = "http://xxxxxxxxxxxxxx:8080/bgbilling/executer/ru.bitel.bgbilling.kernel.contract.balance/PaymentService?wsdl";
@comment = ("<comment>$comment</comment>");
$authoriz = 'Basic '.encode_base64('login:password');
#$SOAP::Constants::PREFIX_ENV = 'SOAP-ENV';
#$SOAP::Constants::PREFIX_ENC = "SOAP-ENC";
$client = SOAP::Lite->new(service=>$wsdl);
$client->proxy($wsdl);
$client->ns("http://common.balance.contract.kernel.bgbilling.bitel.ru/","ns1");
$client->outputxml('true');
$client->transport->http_request->headers->push_header('Authorization' => $authoriz );
$soap = $client->service($wsdl.'?wsdl');
my $pm = SOAP::Data->new(name=>"payment");
$pm->type("ts:payment");
$pm->attr({ id => "$id", contractId=>"$cid", date=>"$dt", sum=>"$sum", summa=>"$sum", typeId=>"3", userId=>"0"});
$pm->value(@comment);
print $client->call('paymentUpdate',$pm);