首先,我承认我是Web服务的新手,虽然我熟悉HTML和基本Web内容.我使用Python创建了一个快速而肮脏的Web服务,该服务调用MySQL数据库中的存储过程,该服务只返回BIGINT值.我想在Web服务中返回此值,并且我想生成一个我可以为Web开发人员提供的WSDL.我可以补充一点,存储过程只返回一个值.
这是一些示例代码:
#!/usr/bin/python
import SOAPpy
import MySQLdb
def getNEXTVAL():
cursor = db.cursor()
cursor.execute( "CALL my_stored_procedure()" ) # Returns a number
result=cursor.fetchall()
for record in result:
return record[0]
db=MySQLdb.connect(host="localhost", user="myuser", passwd="********", db="testing")
server = SOAPpy.SOAPServer(("10.1.22.29", 8080))
server.registerFunction(getNEXTVAL)
server.serve_forever()
Run Code Online (Sandbox Code Playgroud)
我想生成一个我可以给网络人员的WSDL,我想知道是否可以让SOAPpy为我生成一个.这可能吗?
我正在与第三方合作,将我们的一些系统与他们的系统集成在一起,它们为我们提供了一个SOAP接口,用于在其连接的系统中进行某些请求和更改.对我来说问题是他们不提供WSDL文件供我使用.如果我有一个WSDL文件,那么运行提供的.NET命令(wsdl.exe)并生成一个代理类来与服务进行交互就是一件简单的事情.
没有WSDL文件,有一种"简单"的方法吗?我拥有可以访问的所有功能以及需要发送的参数以及我应该期待的回报.
拥有没有WSDL文件的SOAP服务是否常见?(我问这个,因为我们将来会增加更多的外部系统)
有没有人针对无WDSL服务完成代理类或任何其他形式的客户端,并且有任何关于如何做的好指示?
我希望生成一个简单的独立Java客户端,它将在给定wsdl的情况下调用SOAP Web服务.当我说简单和独立时,我的意思是,一旦我完成,我希望能够做类似的事情
import my.generated.nonsense;
public static void main(String[] args) {
Client client = new Client();
client.getSomething();
}
Run Code Online (Sandbox Code Playgroud)
我最近和Maven在其他一些项目上玩得很开心,我想继续这样做,所以我的目标就是在这里使用它.我不希望该工具生成任何期望允许我执行上述操作的类.
最近有人这么做了,可以推荐一个ws库和Maven插件吗?谢谢.
SOAP规范令人困惑,数量众多,并且可以在多个版本中使用,而我的soap库的WSDL生成器也是错误的.整数数组的正确WSDL是什么?可能是:
<element name="ArrayOfIntegers">
<complexType base="SOAP-ENC:Array">
<element name="integer" type="xsd:integer" maxOccurs="unbounded"/>
</complexType>
<anyAttribute/>
</element>
Run Code Online (Sandbox Code Playgroud)
或者它(来自wsdl规范):
<complexType name="ArrayOfFloat">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType"
wsdl:arrayType="xsd:integer[]"/>
</restriction>
</complexContent>
</complexType>
Run Code Online (Sandbox Code Playgroud)
或者怎么样:
<element name="ArrayOfIntegers">
<complexType>
<sequence>
<element maxOccurs="unbounded" name="integer" type="xsd:int"/>
</sequence>
</complexType>
</element>
Run Code Online (Sandbox Code Playgroud)
或者是其他东西?
我有一个Web服务,我正在GlassFish上部署它.我通过http:// localhost:10697/APIService/APIServiceService?wsdl访问了它的wsdl.
现在我将WAR文件移植到Tomcat 6.0.24并进行部署.但是我试图使用http:// localhost:8080/APIService/APIServiceService?wsdl访问其wsdl,但我收到404错误.我尝试了各种组合,但似乎都没有.
如何访问wsdl文件plz?
感谢致敬,
更新:你在这里web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
Run Code Online (Sandbox Code Playgroud)
但我找不到sun-jaxws.xml......非常感谢!问候
我一直在PHP中玩它,并得到一些工作,我做的是:
$client = new SoapClient("http://ws.cdyne.com/WeatherWS/Weather.asmx?wsdl");
$fetchedArr = $client->GetCityForecastByZIP(array("ZIP" => "10451")); //get the weather in the bronx YO!
Run Code Online (Sandbox Code Playgroud)
现在我希望我的应用程序我WPF/C#也能这样做.c#中的等价物是什么?
我一直在努力应对以下错误,过去几天你可以帮忙!
我使用wsdl 2.0文件中的wsdl2java工具生成了我的服务器和客户端代码.在调用webservice时,我收到以下错误:
org.apache.axis2.AxisFault: The endpoint reference (EPR) for the
Operation not found is
/axis2/services/MyService/authentication/?username=Denise345&password=xxxxx
and the WSA Action = null
Run Code Online (Sandbox Code Playgroud)
我的服务显示在axis2网页上,包含所有可用方法.这是TcpMon的输出
==============
Listen Port: 8090
Target Host: 127.0.0.1
Target Port: 8080
==== Request ====
GET /axis2/services/MyService/authentication/?username=Denise345&password=xxxxx
HTTP/1.1
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
SOAPAction: ""
User-Agent: Axis2
Host: 127.0.0.1:8090
==== Response ====
HTTP/1.1 500 Internal Server Error
Server: Apache-Coyote/1.1
Content-Type: application/xml;charset=UTF-8
Transfer-Encoding: chunked
Date: Thu, 12 May 2011 15:53:20 GMT
Connection: close
12b
<soapenv:Reason xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Text xml:lang="en-US">The endpoint reference (EPR) for the …Run Code Online (Sandbox Code Playgroud) 我想将我的Maven2构建文件切换为gradle.使用gradle从WSDL + XSD生成java类似乎没有进一步记录,没有gradle插件.我使用maven的以下配置并搜索gradle的等效项.
<!-- plugin for generating the classes from the WSDL+XSD -->
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.7.3</version>
<executions>
<execution>
<id>app1-stub-generation</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaDirectory>${project.build.directory}/wsdl/app1</schemaDirectory>
<schemaIncludes>
<include>*.xsd</include>
</schemaIncludes>
<generatePackage>org.app1.ws.generated</generatePackage>
<generateDirectory>${project.build.directory}/generated-sources/app1</generateDirectory>
<strict>true</strict>
</configuration>
</execution>
<execution>
<id>app2-v1-stub-generation</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaDirectory>src/main/resources/wsdl</schemaDirectory>
<schemaIncludes>
<include>v1/*.xsd</include>
</schemaIncludes>
<generatePackage>org.app2.ws.generated.v1</generatePackage>
<generateDirectory>${project.build.directory}/generated-sources/v1</generateDirectory>
<strict>true</strict>
</configuration>
</execution>
<execution>
<id>app2-v2-stub-generation</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaDirectory>src/main/resources/wsdl</schemaDirectory>
<schemaIncludes>
<include>v2/*.xsd</include>
</schemaIncludes>
<generatePackage>org.app2.ws.generated.v2</generatePackage>
<generateDirectory>${project.build.directory}/generated-sources/v2</generateDirectory>
<strict>true</strict>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud) 我遵循WSDL优先(由我们的客户提供)方法来开发WCF服务,但是从我的wcf服务生成的WSDL与我们的客户提供给我的WSDL略有不同,并且由于这种不匹配,客户端在调用时遇到了困难.我的服务.
客户提供wsdl:
<wsdl:service name='CheckoutService'>
<wsdl:port binding='tns:CheckoutBinding' name='CheckoutServicePort'>
<soap:address location='place holder to service uri' />
</wsdl:port>
</wsdl:service>
从wcf服务生成的WSDL:
<wsdl:service name="CheckoutService">
<wsdl:port binding="tns:CheckoutBinding" name="CheckoutBinging">
<soap:address location="place holder to service uri" />
</wsdl:port>
</wsdl:service>
而且,我的服务设置如下:
<endpoint name="CheckoutBinding" address="" binding="basicHttpBinding" bindingName="CheckoutServicePort" bindingConfiguration="basicHttpBinding" bindingNamespace="<<namespace>>" contract="<<contractname>>" />
我已经使用WSCF.Blue从客户端提供的wsdl生成服务器存根代码,并在生成的代码中进行了微小的更改,以发出与客户端提供的WSDL完全相同的WSDL,但我不知道要在客户端提供什么更改.配置文件或生成的代码,以获得与客户端提供的wsdl文件相同的"wsdl:port/@ name".
根据此URL,serviceendpoint名称属性将映射到wsdl:port/@ name和wsdl:binding/@ name.基于此,我的配置文件中的endpoint/@ name属性值映射到wsdl:port/@ name和wsdl:binding/@ name但我希望将不同的名称映射到wsdl:port/@ name和wsdl:binding/@name属性.
请帮助我实现这一目标.
摘要
在这里,我将列出我为解决这个问题而采取的所有步骤,作为其他人的参考.
PHP,愚蠢地,"监听"函数的输入消息,以定义它应该使用的函数.因此,即使它使用相同的类型或元素,也要为每个函数提供不同的输入消息.您可能认为这对您来说很有帮助,但可以这样做:
<xsi:complexType name="UserCredentials">
<xsi:attribute name="customerID" type="xsi:int"/>
</xsi:complexType>
<xsi:element name="UserCredentials" type="types:UserCredentials"/>
<xsi:element name="UserCredentials1" type="types:UserCredentials"/>
<wsdl:message name="getCustomerCredentials">
<wsdl:part name="body" element="types:UserCredentials"/>
</wsdl:message>
<wsdl:message name="getCustomerCredentials1">
<wsdl:part name="body" element="types:UserCredentials1"/>
</wsdl:message>
Run Code Online (Sandbox Code Playgroud)
接下来,Visual Studio抱怨,我花了几天时间想出这个愚蠢的愚蠢的简单的事情,只需告诉程序你刚刚设置了对象属性:
UserCredentials.customerID = User.CustomerID;
UserCredentials.customerIDSpecified = true;
Run Code Online (Sandbox Code Playgroud)
就是这样.我自己也不敢相信.我花了1.5周,解决方案是两个步骤,请给这个在下面回答一些票的人.
更新
我的输入对象不会开始解析为XML.
//固定:
您必须告诉程序该属性设置如下:
UserCredentials.customerID = User.CustomerID;
UserCredentials.customerIDSpecified = true;
Run Code Online (Sandbox Code Playgroud)
提琴手说明了这一点:
输入
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<UserCredentials2 xmlns="http://5.157.80.21/servicehandler/wsdl_service.wsdl"/>
</s:Body>
</s:Envelope>
Run Code Online (Sandbox Code Playgroud)
产量
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="types">
<SOAP-ENV:Body>
<ns1:PersoonArray/>
</SOAP-ENV:Body>
</SOAP-ENV:E??nvelope>
Run Code Online (Sandbox Code Playgroud)
这段代码有问题吗?
public static List<Klant> GetAllPersonen()
{
List<Klant> list = new List<Klant>();
WeGotchaService.Persoon[] …Run Code Online (Sandbox Code Playgroud)