Rumah > pembangunan bahagian belakang > tutorial php > 【原】使用wsdl的注意事项_PHP教程

【原】使用wsdl的注意事项_PHP教程

WBOY
Lepaskan: 2016-07-13 17:17:18
asal
709 orang telah melayarinya

<span 1</span> <span <</span><span wsdl:message </span><span name</span><span ="MinusIn"</span><span ></span>
<span 2</span>        <span <</span><span wsdl:part </span><span name</span><span ="parameters1"</span><span  element</span><span ="s::int"</span><span /></span>
<span 3</span>        <span <</span><span wsdl:part </span><span name</span><span ="parameters2"</span><span  element</span><span ="s::int"</span><span /></span>
<span 4</span> <span </</span><span wsdl:message</span><span ></span>
Salin selepas log masuk
<span 1</span> <span <</span><span wsdl:message </span><span name</span><span ="MinusIn"</span><span ></span>
<span 2</span>       <span <</span><span wsdl:part </span><span name</span><span ="parameters1"</span><span  element</span><span ="s:int"</span><span /></span>
<span 3</span>       <span <</span><span wsdl:part </span><span name</span><span ="parameters2"</span><span  element</span><span ="s:int"</span><span /></span>
<span 4</span> <span </</span><span wsdl:message</span><span ></span>
Salin selepas log masuk
<span 1</span> <span function</span> Minus2(<span $i</span>, <span $j</span><span )
</span><span 2</span> <span {
</span><span 3</span>       <span $add</span> = <span $i</span> + <span $j</span><span ;
</span><span 4</span>       <span $sub</span> = <span $i</span> - <span $j</span><span ;
</span><span 5</span>       <span return</span> <span array</span>("add"=><span $add</span>, "sub"=><span $sub</span><span );
</span><span 6</span> }
Salin selepas log masuk
<span 1</span> <span <</span><span wsdl:message </span><span name</span><span ="MinusOut"</span><span ></span>
<span 2</span>        <span <</span><span wsdl:part </span><span name</span><span ="add"</span><span  element</span><span ="s:int"</span> <span /></span>
<span 3</span>        <span <</span><span wsdl:part </span><span name</span><span ="sub"</span><span  element</span><span ="s:int"</span> <span /></span>
<span 4</span> <span </</span><span wsdl:message</span><span ></span>
Salin selepas log masuk
<span 1</span> <span $ret</span> = <span $client</span>->Minus2(100, 99<span );
</span><span 2</span> <span var_dump</span>(<span $ret</span><span );
</span><span 3</span> <span array</span>(2) { 'add' => <span string</span>(3) "199" 'sub' => <span string</span>(1) "1" }
Salin selepas log masuk
<span 1</span> <span <</span><span s:element </span><span name</span><span ="MinusType"</span><span ></span>
<span 2</span>      <span <</span><span s:complexType</span><span ></span>
<span 3</span>           <span <</span><span s:sequence</span><span ></span>
<span 4</span>                 <span <</span><span s:element </span><span minOccurs</span><span ="0"</span><span  maxOccurs</span><span ="1"</span><span  name</span><span ="add"</span><span  type</span><span ="s:int"</span> <span /></span>
<span 5</span>                 <span <</span><span s:element </span><span minOccurs</span><span ="0"</span><span  maxOccurs</span><span ="1"</span><span  name</span><span ="sub"</span><span  type</span><span ="s:int"</span> <span /></span>
<span 6</span>             <span </</span><span s:sequence</span><span ></span>
<span 7</span>       <span </</span><span s:complexType</span><span ></span>
<span 8</span> <span </</span><span s:element</span><span ></span>
Salin selepas log masuk
<span 1</span> <span $ret</span> = <span $client</span>->Minus2(100,99<span );
</span><span 2</span> <span var_dump</span>(<span $ret</span><span );
</span><span 3</span> stdClass<span #</span><span 2 (2) { public $add => int(199) public $sub => int(1) }</span>
Salin selepas log masuk
<span  1</span> <span class</span><span  TMinus
</span><span  2</span> <span {
</span><span  3</span>        <span var</span> <span $add</span><span ;
</span><span  4</span>        <span var</span> <span $sub</span><span ;
</span><span  5</span> <span }
</span><span  6</span> <span function</span> Minus2(<span $i</span>, <span $j</span><span )
</span><span  7</span> <span {
</span><span  8</span>       <span $minus</span> = <span new</span><span  TMinus;
</span><span  9</span>       <span $minus</span>->add = <span $i</span> + <span $j</span><span ;
</span><span 10</span>       <span $minus</span>->sub = <span $i</span> - <span $j</span><span ;
</span><span 11</span>       <span return</span> <span $minus</span><span ;
</span><span 12</span> }
Salin selepas log masuk
<span 1</span> <span class</span> stdClass<span #</span><span 2 (2) { public $add => int(199) public $sub => int(1) }</span>
Salin selepas log masuk
<span  1</span> <span <</span><span s:element </span><span name</span><span ="CustomType"</span><span ></span>
<span  2</span>     <span <</span><span s:complexType</span><span ></span>
<span  3</span>          <span <</span><span s:sequence</span><span ></span>
<span  4</span>               <span <</span><span s:element </span><span minOccurs</span><span ="0"</span><span  maxOccurs</span><span ="1"</span><span  name</span><span ="sessionId"</span><span  type</span><span ="s:string"</span> <span /></span>
<span  5</span>               <span <</span><span s:element </span><span minOccurs</span><span ="0"</span><span  maxOccurs</span><span ="1"</span><span  name</span><span ="fileSize"</span><span  type</span><span ="s:string"</span> <span /></span>
<span  6</span>           <span </</span><span s:sequence</span><span ></span>
<span  7</span>       <span </</span><span s:complexType</span><span ></span>
<span  8</span>  <span </</span><span s:element</span><span ></span>
<span  9</span>  <span <</span><span s:element </span><span name</span><span ="CustomTypeArray"</span><span ></span>
<span 10</span>       <span <</span><span s:complexType</span><span ></span>
<span 11</span>             <span <</span><span s:complexContent</span><span ></span>
<span 12</span>                   <span <</span><span s:restriction </span><span base</span><span ="soapenc:Array"</span><span ></span>
<span 13</span>                         <span <</span><span s:attribute </span><span ref</span><span ="soapenc:arrayType"</span><span  wsdl:arrayType</span><span ="tns:CustomType[]"</span><span /></span>
<span 14</span>                   <span </</span><span s:restriction</span><span ></span>
<span 15</span>            <span </</span><span s:complexContent</span><span ></span>
<span 16</span>       <span </</span><span s:complexType</span><span ></span>
<span 17</span>  <span </</span><span s:element</span><span ></span>
Salin selepas log masuk
<span  1</span> <span class</span><span  CustomType
</span><span  2</span> <span {
</span><span  3</span>        <span public</span> <span $sessionId</span><span ;
</span><span  4</span>        <span public</span> <span $fileSize</span><span ;
</span><span  5</span>        <span function</span> __construct(<span $sessionID</span>, <span $fileSize</span><span )
</span><span  6</span> <span        {
</span><span  7</span>              <span $this</span>->sessionId = <span $sessionID</span><span ;
</span><span  8</span>              <span $this</span>-><span fileSize</span> = <span $fileSize</span><span ;
</span><span  9</span> <span        }
</span><span 10</span> <span }
</span><span 11</span> <span function</span><span  GetData()
</span><span 12</span> <span {
</span><span 13</span>        <span $data</span> = <span array</span><span ();
</span><span 14</span>        <span $data</span>[] = <span new</span> CustomType("123", "456"<span );
</span><span 15</span>        <span $data</span>[] = <span new</span> CustomType("789", "912"<span );
</span><span 16</span>        <span return</span> <span $data</span><span ;
</span><span 17</span> }
Salin selepas log masuk
<span 1</span> <span $data</span> = <span $client</span>-><span GetData(); 
</span><span 2</span> <span foreach</span>(<span $data</span> <span as</span> <span $item</span><span ) 
</span><span 3</span> <span { 
</span><span 4</span>      <span echo</span> "<br/>".<span $item</span>->sessionId." and ".<span $item</span>-><span fileSize</span>."<br/>"<span ; 
</span><span 5</span> }
Salin selepas log masuk
<span  1</span> <span <</span><span s:element </span><span name</span><span ="MyInt"</span><span ></span>
<span  2</span>      <span <</span><span s:complexType</span><span ></span>
<span  3</span>            <span <</span><span s:sequence</span><span ></span>
<span  4</span>                 <span <</span><span s:element </span><span minOccurs</span><span ="0"</span><span  maxOccurs</span><span ="1"</span><span  name</span><span ="request"</span><span  type</span><span ="s:int"</span> <span /></span>
<span  5</span>            <span </</span><span s:sequence</span><span ></span>
<span  6</span>      <span </</span><span s:complexType</span><span ></span>
<span  7</span> <span </</span><span s:element</span><span ></span>
<span  8</span> <span <</span><span wsdl:message </span><span name</span><span ="MinusIn"</span><span ></span>
<span  9</span>        <span <</span><span wsdl:part </span><span name</span><span ="parameters1"</span><span  element</span><span ="tns:MyInt"</span><span /></span>
<span 10</span>        <span <</span><span wsdl:part </span><span name</span><span ="parameters2"</span><span  element</span><span ="tns:MyInt"</span><span /></span>
<span 11</span> <span </</span><span wsdl:message</span><span ></span>
Salin selepas log masuk
<span  1</span> <span class</span><span  TMinus
</span><span  2</span> <span {
</span><span  3</span>        <span var</span> <span $add</span><span ;
</span><span  4</span>        <span var</span> <span $sub</span><span ;
</span><span  5</span> <span }
</span><span  6</span> <span function</span> Minus2(<span $i</span>, <span $j</span><span )
</span><span  7</span> <span {
</span><span  8</span>        <span $minus</span> = <span new</span><span  TMinus;
</span><span  9</span>        <span $minus</span>->add = <span $i</span>-><span request;
</span><span 10</span>        <span $minus</span>->sub = <span $j</span>-><span request;
</span><span 11</span>        <span return</span> <span $minus</span><span ;
</span><span 12</span> }
Salin selepas log masuk
Minus2(100, 99)了,而应当修改为:
<span 1</span> <span $ret</span> = <span $client</span>->Minus2(<span array</span>("request"=>100), <span array</span>("request"=>99));
Salin selepas log masuk
<span 1</span> <span $ret</span> = <span $client</span>->__call("Minus2", <span array</span>(<span array</span>("request"=>100), <span array</span>("request"=>99)));
Salin selepas log masuk
<span 1</span> Error: Client, <span string</span>: SOAP-ERROR: Encoding: <span object</span> has no 'sub' property。 
Salin selepas log masuk
<span  1</span> <span <</span><span s:element </span><span name</span><span ="DepartmentInfo"</span><span ></span>
<span  2</span>      <span <</span><span s:complexType</span><span ></span>
<span  3</span>             <span <</span><span s:sequence</span><span ></span>
<span  4</span>                     <span <</span><span s:element </span><span minOccurs</span><span ="1"</span><span  maxOccurs</span><span ="1"</span><span  name</span><span ="index"</span><span  type</span><span ="s:int"</span> <span /></span>
<span  5</span>                     <span <</span><span s:element </span><span minOccurs</span><span ="1"</span><span  maxOccurs</span><span ="1"</span><span  name</span><span ="id"</span><span  type</span><span ="s:string"</span> <span /></span>
<span  6</span>                     <span <</span><span s:element </span><span minOccurs</span><span ="1"</span><span  maxOccurs</span><span ="1"</span><span  name</span><span ="name"</span><span  type</span><span ="s:string"</span> <span /></span>
<span  7</span>             <span </</span><span s:sequence</span><span ></span>
<span  8</span>       <span </</span><span s:complexType</span><span ></span>
<span  9</span> <span </</span><span s:element</span><span ></span>
<span 10</span> <span <</span><span s:element </span><span name</span><span ="DepartmentInfoArray"</span><span ></span>
<span 11</span>        <span <</span><span s:complexType</span><span ></span>
<span 12</span>               <span <</span><span s:complexContent</span><span ></span>
<span 13</span>                     <span <</span><span s:restriction </span><span base</span><span ="soapenc:Array"</span><span ></span>
<span 14</span>                            <span <</span><span s:attribute </span><span ref</span><span ="soapenc:arrayType"</span><span  wsdl:arrayType</span><span ="tns:DepartmentInfo[]"</span><span /></span>
<span 15</span>                     <span </</span><span s:restriction</span><span ></span>
<span 16</span>               <span </</span><span s:complexContent</span><span ></span>
<span 17</span>          <span </</span><span s:complexType</span><span ></span>
<span 18</span> <span </</span><span s:element</span><span ></span>
<span 19</span> <span <</span><span s:element </span><span name</span><span ="getAllDepartmentInfo"</span><span ></span>
<span 20</span>         <span <</span><span s:complexType</span><span ></span>
<span 21</span>               <span <</span><span s:sequence</span><span ></span>
<span 22</span>                     <span <</span><span s:element </span><span minOccurs</span><span ="1"</span><span  maxOccurs</span><span ="1"</span><span  name</span><span ="sessionID"</span><span  type</span><span ="s:string"</span> <span /></span>
<span 23</span>               <span </</span><span s:sequence</span><span ></span>
<span 24</span>        <span </</span><span s:complexType</span><span ></span>
<span 25</span> <span </</span><span s:element</span><span ></span>
<span 26</span> <span <</span><span s:element </span><span name</span><span ="getAllDepartmentInfoResponse"</span><span ></span>
<span 27</span>        <span <</span><span s:complexType</span><span ></span>
<span 28</span>               <span <</span><span s:sequence</span><span ></span>
<span 29</span>                  <span <</span><span s:element </span><span minOccurs</span><span ="1"</span><span  maxOccurs</span><span ="1"</span><span  name</span><span ="errorCode"</span><span  type</span><span ="s:int"</span> <span /></span>
<span 30</span>                  <span <</span><span s:element </span><span minOccurs</span><span ="1"</span><span  maxOccurs</span><span ="1"</span><span  name</span><span ="aDepartmentInfo"</span><span  type</span><span ="tns:DepartmentInfoArray"</span> <span /></span>
<span 31</span>               <span </</span><span s:sequence</span><span ></span>
<span 32</span>        <span </</span><span s:complexType</span><span ></span>
<span 33</span> <span </</span><span s:element</span><span ></span>
Salin selepas log masuk
<span  1</span> <span <</span><span s:complexType </span><span name</span><span ="DepartmentInfo"</span><span ></span>
<span  2</span>       <span <</span><span s:sequence</span><span ></span>
<span  3</span>              <span <</span><span s:element </span><span minOccurs</span><span ="1"</span><span  maxOccurs</span><span ="1"</span><span  name</span><span ="index"</span><span  type</span><span ="s:int"</span> <span /></span>
<span  4</span>              <span <</span><span s:element </span><span minOccurs</span><span ="1"</span><span  maxOccurs</span><span ="1"</span><span  name</span><span ="id"</span><span  type</span><span ="s:string"</span> <span /></span>
<span  5</span>              <span <</span><span s:element </span><span minOccurs</span><span ="1"</span><span  maxOccurs</span><span ="1"</span><span  name</span><span ="name"</span><span  type</span><span ="s:string"</span> <span /></span>
<span  6</span>        <span </</span><span s:sequence</span><span ></span>
<span  7</span> <span </</span><span s:complexType</span><span ></span>
<span  8</span> <span <</span><span s:complexType </span><span name</span><span ="DepartmentInfoArray"</span><span ></span>
<span  9</span>       <span <</span><span s:complexContent</span><span ></span>
<span 10</span>              <span <</span><span s:restriction </span><span base</span><span ="soapenc:Array"</span><span ></span>
<span 11</span>                     <span <</span><span s:attribute </span><span ref</span><span ="soapenc:arrayType"</span><span  wsdl:arrayType</span><span ="tns:DepartmentInfo[]"</span><span /></span>
<span 12</span>               <span </</span><span s:restriction</span><span ></span>
<span 13</span>       <span </</span><span s:complexContent</span><span ></span>
<span 14</span> <span </</span><span s:complexType</span><span ></span>
Salin selepas log masuk

 

 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/626590.htmlTechArticleMinus2( , = + = - ("add"= , "sub"= } = -Minus2(100, 99 ( (2) { 'add' = (3) "199" 'sub' = (1) "1" } = -Minus2(100,99 ( stdClass Minus2( , = -add = + -sub = - } stdClass __construct(...
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan