我创建了一个Web服务客户端,我在创建Web服务时收到以下错误.我想知道我是否遗漏了这个错误:
Error running SQL module: org.apache.cxf.service.factory.ServiceConstructionException: Could not resolve a binding for null
javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Could not resolve a binding for null
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:298)
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:291)
at javax.xml.ws.Service.getPort(Service.java:44)
at net.sf.gateway.client.base.sql.SQLClientBase.setSecurityHeaderTokens(SQLClientBase.java:244)
at net.sf.gateway.client.base.sql.SQLClientBase.get(SQLClientBase.java:292)
at net.sf.gateway.client.module.sql.SQLModule.getBatch(SQLModule.java:149)
at net.sf.gateway.client.module.sql.SQLModule.getAndProcessSQL(SQLModule.java:110)
at net.sf.gateway.client.module.sql.SQLModule.run(SQLModule.java:280)
at net.sf.gateway.client.GatewayClient.exec(GatewayClient.java:399)
at net.sf.gateway.client.GatewayClient.run(GatewayClient.java:174)
at net.sf.gateway.client.GatewayClient.main(GatewayClient.java:166)
Caused by:
org.apache.cxf.service.factory.ServiceConstructionException: Could not resolve a binding for null
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createBindingInfo(AbstractWSDLBasedEndpointFactory.java:404)
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpointInfo(AbstractWSDLBasedEndpointFactory.java:258)
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:146)
at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:51)
at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:102)
at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:115)
at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:437)
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:296)
... 10 more
Caused by:
org.apache.cxf.BusException: No binding factory for …Run Code Online (Sandbox Code Playgroud) 我正在使用SOAPUI工具访问Weblogic 10.3.2中部署的JAX-WS Web服务
请求:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.pc3.polk.com/">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsu:Timestamp wsu:Id="Timestamp-1" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsu:Created>2010-12-03T21:10:43Z</wsu:Created>
<wsu:Expires>2010-12-03T21:44:03Z</wsu:Expires>
</wsu:Timestamp>
<wsu:Timestamp wsu:Id="Timestamp-60" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsu:Created>2010-12-03T20:10:39Z</wsu:Created>
<wsu:Expires>2010-12-03T20:43:59Z</wsu:Expires>
</wsu:Timestamp>
<wsse:UsernameToken wsu:Id="UsernameToken-59" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>rwerqre</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">ewrqwrwerqer</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">Nmw0ksmiOX+hkiSoWb2Rjg==</wsse:Nonce>
<wsu:Created>2010-12-03T20:10:39.649Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<ws:getMetadata/>
</soapenv:Body>
</soapenv:Envelope>
响应:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<SOAP-ENV:Fault xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<faultcode>SOAP-ENV:MustUnderstand</faultcode>
<faultstring>MustUnderstand headers:[{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Security] are not understood</faultstring>
</SOAP-ENV:Fault>
</S:Body>
</S:Envelope>
Run Code Online (Sandbox Code Playgroud) 我用Java开始了一个小项目.
我必须创建一个客户端,它将xml作为HTTP POST请求发送到url.
我尝试使用java.net.* 包(以下是一段代码),但我得到如下错误:
java.io.IOException: Server returned HTTP response code: 500 for URL: "target url"
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
at newExample.main(newExample.java:36)
Run Code Online (Sandbox Code Playgroud)
我的代码如下:
try {
URL url = new URL("target url");
URLConnection connection = url.openConnection();
if( connection instanceof HttpURLConnection )
((HttpURLConnection)connection).setRequestMethod("POST");
connection.setRequestProperty("Content-Length", Integer.toString(requestXml.length()) );
connection.setRequestProperty("Content-Type","text/xml; charset:ISO-8859-1;");
connection.setDoOutput(true);
connection.connect();
// Create a writer to the url
PrintWriter writer = new PrintWriter(new
OutputStreamWriter(connection.getOutputStream()));
// Get a reader from the url
BufferedReader reader = new BufferedReader(new
InputStreamReader(connection.getInputStream()));
writer.println();
writer.println(requestXml);
writer.println();
writer.flush();
String line = …Run Code Online (Sandbox Code Playgroud) 我想使用"Web服务客户端"向导在Eclipse中创建Web服务客户端,但向导不允许我选择Axis2作为Web服务运行时; 我只是简单的Axis.
我从以下屏幕开始(我通过文件 - >新建 - >其他 - > Web服务客户端):

我点击"Web服务运行时:Apache Axis",以获得这个新的"客户端环境配置"对话框:

我选择了"Apache Axis2",但OK按钮显示为灰色.无论我在这个对话框中选择什么 - 即使我选择"Apache Axis" - OK按钮显示为灰色.我无法超越这一步.我使用的是Eclipse的坏版本(Indigo版本20110615-0604),我是否需要安装/升级一些插件(我已经安装了Axis2 Tools 1.1.200v201103022)?这有什么不对?
这是在Windows 7 64位计算机上.
在HTTP Connection标头中,我的Web服务客户端包括:
Connection: Keep-Alive
我想禁用它. 在做了一些研究之后,看来这样做的方法是将SoapHttpChannelOptions类的KeepAlive成员设置为false.但是,我没有看到SoapHttpChannelOptions使用WSE3.0(Web服务增强)在Visual Studio中为我生成的Web服务客户端类中访问/修改的方法.
在我的例子中,生成的存根类扩展 Microsoft.Web.Services3.WebServicesClientProtocol
我一直无法找到任何搜索谷歌的例子,SoapHttpChannelOptions类的大多数成员都被继承到WebServicesClientProtocol类......
SoapHttpChannelOptions参考
WebServicesClientProtocol Reference
注意:我不是要修改Web服务器.我正在尝试修改Web服务客户端.
我正在将应用程序从.net 1.1升级到3.5.此应用程序连接到WCF服务.以前,Web服务客户端配置为使用安全令牌,如下所示:
RegistrationWSWse registrationService = new RegistrationWSWse();
Microsoft.Web.Services2.Security.Tokens.UsernameToken token = new Microsoft.Web.Services2.Security.Tokens.UsernameToken("some username", "some password", Microsoft.Web.Services2.Security.Tokens.PasswordOption.SendPlainText );
registrationService.RequestSoapContext.Security.MustUnderstand=false;
registrationService.RequestSoapContext.Security.Tokens.Add(token);
Run Code Online (Sandbox Code Playgroud)
现在我在Visual Studio中向Web服务添加了一个新的服务引用,但是自动生成的代码没有提供任何设置安全头的方法,如上所述.
这是需要在配置文件中配置的system.serviceModel部分吗?
更新
我没有看到用户名/密码属性的原因是因为我正在使用服务接口,而不是实际的实现类.
我能够通过将实例强制转换为类型来设置这些东西,如下所示:
((RegistrationWSClient)registrationWs).ChannelFactory.Credentials.UserName.UserName = userName;
((RegistrationWSClient)registrationWs).ChannelFactory.Credentials.UserName.Password = password;
Run Code Online (Sandbox Code Playgroud)
您需要做的另一件重要事情是更新客户端app.config文件.如果不这样做,则不会在SOAP标头中设置用户名/密码.例:
<security mode="TransportWithMessageCredential" />
Run Code Online (Sandbox Code Playgroud) 我有一个包含多个Web服务的Web服务项目.其中两个Web服务共享一个在BL类中定义的枚举,如下所示:
public class HumanResourcesService
{
public SomeLibrary.Employee GetEmployee(int employeeCode)
{
var employee = new SomeLibrary.Employee();
employee.Type= SomeLibrary.EmployeeType.SomeType;
return employee ;
}
}
public class BankService
{
public bool ProcessPayment(int employeeCode, EmployeeType employeeType)
{
bool processed = false;
// Boring code
return processed;
}
}
Run Code Online (Sandbox Code Playgroud)
这只是一个例子.
这两个Web服务在Web项目中引用时会生成不同的EmployeeType枚举代理,因此我需要显式转换以调用以下ProcessPayment方法BankService:
public void SomeMethod(int employeeCode)
{
var hrService = new HumanResourcesService();
var employee = hrService.GetEmployee(employeeCode);
var bankService = new BankService();
bankService.ProcessPayment(employee.Code, (MyProject.BankService.EmployeeType) employee.Type);
}
Run Code Online (Sandbox Code Playgroud)
我理解.NET必须这样做才能创建WSDL,但我不能以某种方式使两个服务在代理类上引用相同的枚举而不破坏任何东西?
我正在将Delphi 2007程序转换为Delphi XE2并出现以下错误消息:
无法从WSDL"http:// ....."检索服务/端口"/"的URL端点
我连接的服务是用Delphi 2007编写的.
在2007年,它编译并运行没有问题.在具有相同代码的XE2上,它会因错误而丢失.
我尝试使用新的WSDL导入器重新导入接口,默认设置但没有快乐.
我也尝试过设置端口和服务名称,错误仍然存在.不确定哪些信息有用,但据我所知它是连接.
这是我正在使用的方法的操作
<operation name="CheckRegistration">
<soap:operation soapAction="urn:ScubaUpdateWSIntf-IScubaUpdateWS#CheckRegistration" style="rpc"/>
<input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:ScubaUpdateWSIntf-IScubaUpdateWS"/>
</input>
<output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:ScubaUpdateWSIntf-IScubaUpdateWS"/>
</output>
</operation>
Run Code Online (Sandbox Code Playgroud)
这是消息:
<message name="CheckRegistration10Request">
<part name="centreId" type="xs:int"/>
<part name="centreName" type="xs:string"/>
<part name="checkActiveOnly" type="xs:boolean"/>
</message>
<message name="CheckRegistration10Response">
<part name="return" type="xs:boolean"/>
</message>
Run Code Online (Sandbox Code Playgroud)
除了导入WSDL之外,抛出HTTPRIO并使用调用方法
(HTTPRIO1 as IScubaUpdateWS).CheckRegistration(strtoint(tcentre),tcentreName,true);
Run Code Online (Sandbox Code Playgroud)
我不认为我正在做任何其他事情,因为我说同样的代码适用于Delphi 2007.
我需要使用在Java中使用Https构建的Web服务.使用Eclipse生成Web服务客户端并调用它我使用以下代码:
ServicioTimbradoPruebasLocator ServicioTimbradoLocator = new ServicioTimbradoPruebasLocator();
ServicioTimbradoPruebasSoap ServicioTimbrado = ServicioTimbradoLocator.getServicioTimbradoPruebasSoap();
javax.xml.rpc.Stub s =((javax.xml.rpc.Stub)ServicioTimbrado);
s._setProperty(javax.xml.rpc.Stub.USERNAME_PROPERTY, "XXXXXXXX");
s._setProperty(javax.xml.rpc.Stub.PASSWORD_PROPERTY, "psswd");
String resultado = ServicioTimbrado.generaTimbre(xml.getBytes());
System.out.println("resultado: " +resultado);
Run Code Online (Sandbox Code Playgroud)
在这一行String resultado = ServicioTimbrado.generaTimbre(xml.getBytes()); 我收到以下错误:
AxisFault
[java] faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
[java] faultSubcode:
[java] faultString: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[java] faultActor:
[java] faultNode:
[java] faultDetail:
[java] {http://xml.apache.org/axis/}stackTrace:javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[java] at sun.security.ssl.Alerts.getSSLException(Unknown …Run Code Online (Sandbox Code Playgroud) 我是Java Web Service的新手.我可以说我的知识水平只有10%.有人可以给我一个带有解释的JAX-WS(客户端 - 服务)的HelloWorld示例吗?...
web-services ×5
.net ×3
java ×2
jax-ws ×2
soap ×2
asp.net ×1
axis2 ×1
c# ×1
certificate ×1
cxf ×1
delphi ×1
delphi-2010 ×1
delphi-xe2 ×1
eclipse ×1
keep-alive ×1
security ×1
wcf ×1
wsdl ×1
wse ×1
wse3.0 ×1