php用zendstudio建立wsdl
首先,新建的时候要选择soap,然后deocument和rpc都可以。
类和方法的页面:
<?php
//发货接口
class test{
function send_do_delivery($orderid,$money,$freight,$shipname,$shiptel,$shipmobile,$shipzip,$shiparea,$shipaddr,$memo,$send,$gift_send){
$orderData=array(
'order_id' =>$orderid,
'delivery' =>'1',
'logi_id' =>'1',
'other_name' =>'',
'logi_no' =>'',
'money' =>$money,
'is_protect' =>false,
'cost_freight' =>$freight,
'ship_name' =>$shipname,
'ship_tel' => $shiptel,
'ship_mobile' =>$shipmobile,
'ship_zip' =>$shipzip,
'ship_area' =>$shiparea,
'ship_addr' =>$shipaddr,
'memo' =>$memo,
'send' => $send,
'gift_send' => $gift_send
);
/**拼凑提交的数据*/
$params = array(
'parms' => json_encode($orderData)
);
$url = "http://XXXXXX/tools-do_delivery.html"; $res=$this->sendByPost($url,$params);
//var_dump();
return $res;
} #发送ERP请求
function sendByPost($url,$paramArray){
$postdata = http_build_query($paramArray);
$length = strlen($postdata);
$cl = curl_init($url);
curl_setopt($cl, CURLOPT_POST, true);
curl_setopt($cl,CURLOPT_HTTP_VERSION,CURL_HTTP_VERSION_1_1);
curl_setopt($cl,CURLOPT_HTTPHEADER,array("Content-Type: application/x-www-form-urlencoded","Content-length: ".$length));
curl_setopt($cl,CURLOPT_POSTFIELDS,$postdata);
curl_setopt($cl,CURLOPT_RETURNTRANSFER,true);
$content = curl_exec($cl);
curl_close($cl);
return ($content);
}
}
?>
server.php
<?php
include("delivery.php");
$Server=new SoapServer('delivery.wsdl'); //SoapServer
$Server->setClass("test");
$Server->handle();
?>
delivery.wsdl(rpc单参数)
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://127.0.0.1/urlcode/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="delivery" targetNamespace="http://127.0.0.1/urlcode/">
<wsdl:message name="send_do_deliveryRequest"> <wsdl:part name="orderid" type="xsd:string"></wsdl:part>
</wsdl:message>
<wsdl:message name="send_do_deliveryResponse">
<wsdl:part name="send_do_deliveryResponse" type="xsd:string"/>
</wsdl:message>
<wsdl:portType name="delivery">
<wsdl:operation name="send_do_delivery">
<wsdl:input message="tns:send_do_deliveryRequest"/>
<wsdl:output message="tns:send_do_deliveryResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="deliverySOAP" type="tns:delivery">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="send_do_delivery">
<soap:operation soapAction="http://127.0.0.1/urlcode/send_do_delivery"/>
<wsdl:input>
<soap:body namespace="http://127.0.0.1/urlcode/" use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body namespace="http://127.0.0.1/urlcode/" use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="delivery">
<wsdl:port binding="tns:deliverySOAP" name="deliverySOAP">
<soap:address location="http://127.0.0.1/urlcode/server.php"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
deliverySOAP里面要改成server.php的路径
rpc多参数
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://127.0.0.1/urlcode/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="delivery" targetNamespace="http://127.0.0.1/urlcode/">
<wsdl:message name="send_do_deliveryRequest"> <wsdl:part name="orderid" type="xsd:string"></wsdl:part>
<wsdl:part name="memo" type="xsd:string"></wsdl:part>
</wsdl:message>
<wsdl:message name="send_do_deliveryResponse">
<wsdl:part name="send_do_deliveryResponse" type="xsd:string"/>
<wsdl:part name="msg" type="xsd:string"></wsdl:part>
</wsdl:message>
<wsdl:portType name="delivery">
<wsdl:operation name="send_do_delivery">
<wsdl:input message="tns:send_do_deliveryRequest"/>
<wsdl:output message="tns:send_do_deliveryResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="deliverySOAP" type="tns:delivery">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="send_do_delivery">
<soap:operation soapAction="http://127.0.0.1/urlcode/send_do_delivery"/>
<wsdl:input>
<soap:body namespace="http://127.0.0.1/urlcode/" use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body namespace="http://127.0.0.1/urlcode/" use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="delivery">
<wsdl:port binding="tns:deliverySOAP" name="deliverySOAP">
<soap:address location="http://127.0.0.1/urlcode/server.php"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
document多参数
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://127.0.0.1/urlcode" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="delivery" targetNamespace="http://127.0.0.1/urlcode">
<wsdl:types>
<xsd:schema targetNamespace="http://127.0.0.1/urlcode">
<xsd:element name="send_do_delivery">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="in" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="send_do_deliveryResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="out" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="send_do_deliveryRequest">
<wsdl:part element="tns:send_do_delivery" name="parameters"/>
<wsdl:part name="orderid" type="xsd:string"></wsdl:part>
<wsdl:part name="memo" type="xsd:string"></wsdl:part>
</wsdl:message>
<wsdl:message name="send_do_deliveryResponse">
<wsdl:part element="tns:send_do_deliveryResponse" name="parameters"/>
<wsdl:part name="status" type="xsd:string"></wsdl:part>
<wsdl:part name="msg" type="xsd:string"></wsdl:part>
</wsdl:message>
<wsdl:portType name="delivery">
<wsdl:operation name="send_do_delivery">
<wsdl:input message="tns:send_do_deliveryRequest"/>
<wsdl:output message="tns:send_do_deliveryResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="deliverySOAP" type="tns:delivery">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="send_do_delivery">
<soap:operation soapAction="http://127.0.0.1/urlcode/NewOperation"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="delivery">
<wsdl:port binding="tns:deliverySOAP" name="deliverySOAP">
<soap:address location="http://127.0.0.1/urlcode/server.php"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
php用zendstudio建立wsdl的更多相关文章
- php 使用zendstudio 生成webservice文件 wsdl
首先新建一个项目 在项目中新建下面这些文件 php类文件 test.php <?php class test { public function __construct() { } public ...
- 基于PHP——简单的WSDL的创建(WSDL篇)
1.建立WSDL文件 建立WSDL的工具很多,eclipse.zendstudio.vs都可以,我个人建议自己写,熟悉结构,另外自动工具对xml schame类型支持在类型中可能会报错. 下 ...
- (转)基于PHP——简单的WSDL的创建(WSDL篇)
本文转载自:http://blog.csdn.net/rrr4578/article/details/24451943 1.建立WSDL文件 建立WSDL的工具很多,eclipse.zends ...
- [z] .net与java建立WebService再互相调用
http://blog.csdn.net/yenange/article/details/5824967 : .net建立WebService,在Java中调用. 1.在vs中新建web 简单修改一下 ...
- .net与java建立WebService再互相调用
A: .net建立WebService,在java中调用. 1.在vs中新建web 简单修改一下Service.cs的[WebMethod]代码: using System; using System ...
- webservice(二)简单实例
1.建立WSDL文件 建立WSDL的工具很多,eclipse.zendstudio.vs都可以,我个人建议自己写,熟悉结构,另外自动工具对xml schame类型支持在类型中可能会报错. 下 ...
- 主题:实战WebService II: SOAP篇(基于php)
概述(SOAP和XML-PRC比较) 在Web服务发展的初期,XML格式化消息的第一个主要用途是,应用于XML-RPC协议,其中RPC代表远程过程调用.在XML远程过程调用 (XML-RPC)中,客户 ...
- SOAP扩展PHP轻松实现WebService
最近在一个PHP项目中对接外部接口涉及到WebService,搜索引擎上相关文章不是很多,找到的大都是引用一个号称很强大的开源软件 NuSOAP(下载地址:http://sourceforge.net ...
- JAX-WS(一)之使用wsgen从Java创建简单的WebService
概念 JAX-WS2.0的全称Java API for XML-Based Web Service 2.0.JAX-WS2.0是对JAX-RPC1.0规范的扩展,是JAX-RPC1.1的后续版本,JA ...
随机推荐
- 九度oj-题目1103:二次方程计算器
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:2799 解决:633 题目描述: 设计一个二次方程计算器 输入: 每个案例是关于x的一个二次方程表达式,为了简单,每个系数都是整数形式. 输 ...
- UVA 796 连通图求桥
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=86270#problem/C#include<iostream> #inclu ...
- 搭建TXManager分布式事务协调者
事务分组id 缓存到redis 需要配置连接到自己的 redis地址 启动后:
- HIVE 2.1.0 安装教程。(数据源mysql)
前期工作 安装JDK 安装Hadoop 安装MySQL 安装Hive 下载Hive安装包 可以从 Apache 其中一个镜像站点中下载最新稳定版的 Hive, apache-hive-2.1.0-bi ...
- ajax02-XMLHttpRequest 对象的使用
XMLHttpRequest 是 AJAX 的基础,用于在后台与服务器交换数据.这意味着可以在不重新加载整个网页的情况下,对网页的某部分进行更新. XMLHttpRequest 对象 所有现代浏览器均 ...
- SGU 106 The equation 扩展欧几里德
106. The equation time limit per test: 0.25 sec. memory limit per test: 4096 KB There is an equation ...
- Groovy 配置环境变量
转载请标明出处:http://blog.csdn.net/zhaoyanjun6/article/details/70313790 本文出自[赵彦军的博客] 概念 Groovy 配置环境变量 开发工具 ...
- js命令模式
命令模式(Command),将一个请求封装为一个对象,从而使你可用不同的请求对客户进行参数化:对请求排队或记录请求日志,以及支持可撤销的操作. 从命令模式的结构图可以看出,它涉及到五个角色,它们分别是 ...
- Mac上的抓包工具Charles[转载]
今天就来看一下Mac上如何进行抓包,之前有一篇文章介绍了使用Fidder进行抓包 http://blog.csdn.net/jiangwei0910410003/article/details/198 ...
- sql处理数据库锁的存储过程
/*--处理死锁 查看当前进程,或死锁进程,并能自动杀掉死进程 因为是针对死的,所以如果有死锁进程,只能查看死锁进程 当然,你可以通过参数控制,不管有没有死锁,都只查看死锁进程 --邹建 2004.4 ...