编辑: 似乎Domino没有发送安全标头以及Soap请求。我可以访问服务提供商的日志,这是我发现的:
2016-06-09 10:27:01 EDT [MED.0050.0239D] Substituted fault reason = Mediator encountered an error:Incoming request does not contain the Authorization header. This service requires the HTTP Basic Authentication token to be present! while executing operation:retraitEquipementServMoCA service:equipementMoCA at time:10:27:01 on date:2016-06-09. The client ip was:10.150.1.34. The current user:Default. The consumer application:null
我必须修改使用Web服务的现有Lotus Notes应用程序。它在prod中很好地完成了,但在DEV中,我们有一个新的WSDL,终点也是一个DEV服务器。
我必须修改定义定位符,存根和服务以适应新WSDL(更改端口名称)的行,我想我已经做到了这一点。
我无法弄清楚发生了什么。我读到Domino只支持SOAP 1.1,所以我修改了WSDL以使用soap 1.1而不是1.2,但我仍然是401错误。
我已经从WSDL重建了Domino中的Web使用者大约3-4次,并且我无法停止获取401错误。这是日志的一部分:
2016-06-09 08:26:25 HTTP JVM: DEBUG endpoint: http://bsiesglba1.int.videotron.com:5555/ws/equipementMoCA
2016-06-09 08:26:25 HTTP JVM: DEBUG portname: equipementMoCA.equipementMoCAsoaphttp
2016-06-09 08:26:25 HTTP JVM: ==DEBUG==
2016-06-09 08:26:25 HTTP JVM: URL: http://bsiesglba1.int.videotron.com:5555/ws/equipementMoCA
2016-06-09 08:26:25 HTTP JVM: User: :
2016-06-09 08:26:25 HTTP JVM: Erreur MoCa : Agent MoCaRequest
2016-06-09 08:26:25 HTTP JVM: WebServiceEngineFault
2016-06-09 08:26:25 HTTP JVM: faultCode: {http://www.lotus.com/domino/ws/}HTTP
2016-06-09 08:26:25 HTTP JVM: faultSubcode:
2016-06-09 08:26:25 HTTP JVM: faultString: (401) 401
2016-06-09 08:26:25 HTTP JVM: faultActor:
2016-06-09 08:26:25 HTTP JVM: faultNode:
2016-06-09 08:26:25 HTTP JVM: faultDetail:
2016-06-09 08:26:25 HTTP JVM: {}string:
2016-06-09 08:26:25 HTTP JVM: (401) 401
2016-06-09 08:26:25 HTTP JVM: at lotus.domino.axis.transport.http.HTTPSender.readFromSocket(Unknown Source)
2016-06-09 08:26:25 HTTP JVM: at lotus.domino.axis.transport.http.HTTPSender.invoke(Unknown Source)
2016-06-09 08:26:25 HTTP JVM: at lotus.domino.axis.strategies.InvocationStrategy.visit(Unknown Source)
2016-06-09 08:26:25 HTTP JVM: at lotus.domino.axis.SimpleChain.doVisiting(Unknown Source)
2016-06-09 08:26:25 HTTP JVM: at lotus.domino.axis.SimpleChain.invoke(Unknown Source)
2016-06-09 08:26:25 HTTP JVM: at lotus.domino.axis.client.AxisClient.invoke(Unknown Source)
2016-06-09 08:26:25 HTTP JVM: at lotus.domino.axis.client.Call.invokeEngine(Unknown Source)
2016-06-09 08:26:25 HTTP JVM: at lotus.domino.axis.client.Call.invoke(Unknown Source)
2016-06-09 08:26:25 HTTP JVM: at lotus.domino.axis.client.Call.invoke(Unknown Source)
2016-06-09 08:26:25 HTTP JVM: at lotus.domino.axis.client.Call.invoke(Unknown Source)
2016-06-09 08:26:25 HTTP JVM: at lotus.domino.axis.client.Call.invoke(Unknown Source)
2016-06-09 08:26:25 HTTP JVM: at lotus.domino.websvc.client.Call.invoke(Unknown Source)
2016-06-09 08:26:25 HTTP JVM: at com.videotron.www.MoCA.gestionEquipement.ServiceConfActMngt_HomeNetworking_webservices_equipementMoCA_BinderStub.retraitEquipementServMoCA(ServiceConfActMngt_HomeNetworking_webservices_equipementMoCA_BinderStub.java:20)
2016-06-09 08:26:25 HTTP JVM: at com.videotron.factory.equipementMoCaFactory.WSClientFactory.wsRemoveEquipment(Unknown Source)
2016-06-09 08:26:25 HTTP JVM: at MoCaRequest.NotesMain(Unknown Source)
2016-06-09 08:26:25 HTTP JVM: at lotus.domino.AgentBase.runNotes(Unknown Source)
2016-06-09 08:26:25 HTTP JVM: at lotus.domino.NotesThread.run(Unknown Source)
这是WSDL:
<wsdl:definitions name="equipementMoCA" targetNamespace="http://www.videotron.com/MoCA/gestionEquipement" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:tns="http://www.videotron.com/MoCA/gestionEquipement" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/">
<wsdl:documentation/>
<wsdl:types>
<xsd:schema targetNamespace="http://www.videotron.com/MoCA/gestionEquipement">
<xsd:complexType name="retraitEquipementServMoCA">
<xsd:sequence>
<xsd:element name="noCompteClient" nillable="true" type="xsd:string"/>
<xsd:element name="noSerie" nillable="true" type="xsd:string"/>
<xsd:element name="typeAppareil" nillable="true" type="xsd:string"/>
<xsd:element name="systemeSource" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="cErrorDefRec">
<xsd:sequence>
<xsd:element name="errorNb" nillable="true" type="xsd:string"/>
<xsd:element name="errorText" nillable="true" type="xsd:string"/>
<xsd:element name="severity" nillable="true" type="xsd:string"/>
<xsd:element name="errorType" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ajoutEquipementServMoCA">
<xsd:sequence>
<xsd:element name="noCompteClient" nillable="true" type="xsd:string"/>
<xsd:element name="noSerie" nillable="true" type="xsd:string"/>
<xsd:element name="typeAppareil" nillable="true" type="xsd:string"/>
<xsd:element name="systemeSource" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="ajoutEquipementServMoCA" type="tns:ajoutEquipementServMoCA"/>
<xsd:element name="cErrorDefRec" type="tns:cErrorDefRec"/>
<xsd:element name="retraitEquipementServMoCA" type="tns:retraitEquipementServMoCA"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="equipementMoCA_PortType_retraitEquipementServMoCA">
<wsdl:part name="parameters" element="tns:retraitEquipementServMoCA">
</wsdl:part>
</wsdl:message>
<wsdl:message name="equipementMoCA_PortType_ajoutEquipementServMoCA">
<wsdl:part name="parameters" element="tns:ajoutEquipementServMoCA">
</wsdl:part>
</wsdl:message>
<wsdl:message name="equipementMoCA_PortType_cErrorDefRec">
<wsdl:part name="parameters" element="tns:cErrorDefRec">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="equipementMoCA_PortType">
<wsdl:operation name="ajoutEquipementServMoCA">
<wsdl:input message="tns:equipementMoCA_PortType_ajoutEquipementServMoCA">
</wsdl:input>
<wsdl:output message="tns:equipementMoCA_PortType_cErrorDefRec">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="retraitEquipementServMoCA">
<wsdl:input message="tns:equipementMoCA_PortType_retraitEquipementServMoCA">
</wsdl:input>
<wsdl:output message="tns:equipementMoCA_PortType_cErrorDefRec">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ServiceConfActMngt_HomeNetworking_webservices_equipementMoCA_Binder" type="tns:equipementMoCA_PortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="ajoutEquipementServMoCA">
<soap:operation soapAction="ServiceConfActMngt_HomeNetworking_webservices_equipementMoCA_Binder_ajoutEquipementServMoCA" style="document"/>
<wsdl:input>
<soap:body parts="parameters" use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body parts="parameters" use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="retraitEquipementServMoCA">
<soap:operation soapAction="ServiceConfActMngt_HomeNetworking_webservices_equipementMoCA_Binder_retraitEquipementServMoCA" style="document"/>
<wsdl:input>
<soap:body parts="parameters" use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body parts="parameters" use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="equipementMoCA">
<wsdl:port name="equipementMoCAsoaphttp" binding="tns:ServiceConfActMngt_HomeNetworking_webservices_equipementMoCA_Binder">
<soap:address location="http://bsiesglba1.int.videotron.com:5555/ws/equipementMoCA"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
最后,wsFactory类的代码:
public class WSClientFactory {
private String endPoint;
private String userName;
private String password;
private int timeOutDelayInMilliSec =60000; //default
// ****** propriétées input du ws ********
private String noCompteClient= new String("");
private String noSerie= new String("");
private String typeAppareil= new String("");
private String systemeSource= new String("");
// ****** propriétées output du ws ********
private StringHolder errorNb= new StringHolder("");
private StringHolder errorText= new StringHolder("");
private StringHolder severity= new StringHolder("");
private StringHolder errorType= new StringHolder("");
// ****** propriétés locales
EquipementMoCALocator locator;
ServiceConfActMngt_HomeNetworking_webservices_equipementMoCA_BinderStub stub;
EquipementMoCA_PortType service;
public WSClientFactory(String endPoint, String userName, String password, int timeOutDelayInMilliSec ) throws ServiceException, MalformedURLException {
this.endPoint = endPoint;
this.userName = userName;
this.password = password;
this.timeOutDelayInMilliSec = timeOutDelayInMilliSec;
// The Locator class knows how to access our web service
//ServiceActivationMoCALocator locator = new ServiceActivationMoCALocator();
locator = new EquipementMoCALocator();
//stub = (ServiceConfActMngt_HomeNetworking_webservices_equipementMoCA_BinderStub) locator.getServiceConfActMngt_HomeNetworking_webservices_equipementMoCA_Port(new URL(endPoint));
//service = locator.getServiceConfActMngt_HomeNetworking_webservices_equipementMoCA_Port();
stub = (ServiceConfActMngt_HomeNetworking_webservices_equipementMoCA_BinderStub) locator.getEquipementMoCAsoaphttp(new URL(endPoint));
service = locator.getEquipementMoCAsoaphttp();
System.out.print("DEBUG endpoint: " + stub.getEndpoint());
System.out.print("DEBUG portname: " + stub.getPortName());
// setting du timeout pour la durée maxi avant output du ws
stub.setTimeout(timeOutDelayInMilliSec);
// Authentication
if (!userName.equals("")){
stub._setProperty(lotus.domino.axis.client.Call.USERNAME_PROPERTY, userName);
stub._setProperty(lotus.domino.axis.client.Call.PASSWORD_PROPERTY, password);
}
}
public WSClientFactory(String endPoint, String userName, String password)throws ServiceException, MalformedURLException {
this.endPoint = endPoint;
this.userName = userName;
this.password = password;
// The Locator class knows how to access our web service
//ServiceActivationMoCALocator locator = new ServiceActivationMoCALocator();
locator = new EquipementMoCALocator();
//stub = (ServiceConfActMngt_HomeNetworking_webservices_equipementMoCA_BinderStub) locator.getServiceConfActMngt_HomeNetworking_webservices_equipementMoCA_Port(new URL(endPoint));
//service = locator.getServiceConfActMngt_HomeNetworking_webservices_equipementMoCA_Port();
stub = (ServiceConfActMngt_HomeNetworking_webservices_equipementMoCA_BinderStub) locator.getEquipementMoCAsoaphttp(new URL(endPoint));
service = locator.getEquipementMoCAsoaphttp();
// setting du timeout pour la durée maxi avant output du ws
stub.setTimeout(timeOutDelayInMilliSec);
// Authentication
if (!userName.equals("")){
stub._setProperty(lotus.domino.axis.client.Call.USERNAME_PROPERTY, userName);
stub._setProperty(lotus.domino.axis.client.Call.PASSWORD_PROPERTY, password);
}
}
/*
* Methode permettant de faire l'ajout d'un appareil (noSerie) au comtpe client(noCompteClient) dans le dépôt MoCa
*/
public boolean wsAddEquipment(String noCompteClient, String noSerie, String typeAppareil, String systemeSource) throws MalformedURLException, ServiceException, RemoteException{
service.ajoutEquipementServMoCA(noCompteClient, noSerie, typeAppareil, systemeSource,
this.errorNb, this.errorText, this.severity, this.errorType);
// dans la réponse du ws, si la valeur de erroNb = 0, c'est que ça a fonctionné
if (this.errorNb.equals("0")){
return true;
}else {
return false;
}
}
/*
* Methode permettant de faire la suppression d'un appareil (noSerie) au comtpe client(noCompteClient) dans le dépôt MoCa
*/
public boolean wsRemoveEquipment(String noCompteClient, String noSerie, String typeAppareil, String systemeSource) throws MalformedURLException, ServiceException, RemoteException{
service.retraitEquipementServMoCA(noCompteClient, noSerie, typeAppareil, systemeSource,
this.errorNb, this.errorText, this.severity, this.errorType);
// dans la réponse du ws, si la valeur de erroNb = 0, c'est que ça a fonctionné
if (this.errorNb.equals("0")){
return true;
}else {
return false;
}
}
存根类:
package com.videotron.www.MoCA.gestionEquipement;
public class ServiceConfActMngt_HomeNetworking_webservices_equipementMoCA_BinderStub extends lotus.domino.websvc.client.Stub implements com.videotron.www.MoCA.gestionEquipement.EquipementMoCA_PortType {
public ServiceConfActMngt_HomeNetworking_webservices_equipementMoCA_BinderStub(java.net.URL endpointURL, javax.xml.rpc.Service service) throws lotus.domino.types.Fault {
super(endpointURL, service);
}
public void ajoutEquipementServMoCA(java.lang.String noCompteClient, java.lang.String noSerie, java.lang.String typeAppareil, java.lang.String systemeSource, javax.xml.rpc.holders.StringHolder errorNb, javax.xml.rpc.holders.StringHolder errorText, javax.xml.rpc.holders.StringHolder severity, javax.xml.rpc.holders.StringHolder errorType) throws java.rmi.RemoteException {
lotus.domino.websvc.client.Call _call = createCall("ajoutEquipementServMoCA");
java.lang.Object _resp = _call.invoke(new java.lang.Object[] {noCompteClient, noSerie, typeAppareil, systemeSource});
errorNb.value = (java.lang.String) _call.convertOutputParam("", "errorNb", java.lang.String.class);
errorText.value = (java.lang.String) _call.convertOutputParam("", "errorText", java.lang.String.class);
severity.value = (java.lang.String) _call.convertOutputParam("", "severity", java.lang.String.class);
errorType.value = (java.lang.String) _call.convertOutputParam("", "errorType", java.lang.String.class);
}
public void retraitEquipementServMoCA(java.lang.String noCompteClient, java.lang.String noSerie, java.lang.String typeAppareil, java.lang.String systemeSource, javax.xml.rpc.holders.StringHolder errorNb, javax.xml.rpc.holders.StringHolder errorText, javax.xml.rpc.holders.StringHolder severity, javax.xml.rpc.holders.StringHolder errorType) throws java.rmi.RemoteException {
lotus.domino.websvc.client.Call _call = createCall("retraitEquipementServMoCA");
java.lang.Object _resp = _call.invoke(new java.lang.Object[] {noCompteClient, noSerie, typeAppareil, systemeSource});
errorNb.value = (java.lang.String) _call.convertOutputParam("", "errorNb", java.lang.String.class);
errorText.value = (java.lang.String) _call.convertOutputParam("", "errorText", java.lang.String.class);
severity.value = (java.lang.String) _call.convertOutputParam("", "severity", java.lang.String.class);
errorType.value = (java.lang.String) _call.convertOutputParam("", "errorType", java.lang.String.class);
}
}
我不知道您是否需要更多信息,但如果需要我会添加它们。
我已经使用SoapUI成功连接到Web服务,所以我知道它可以在提供者端工作。
代码正在运行Domino Release 9.0.1FP4 HF525
答案 0 :(得分:0)
好吧,我设法找到了解决方案,它只是在我的鼻子下......
如果你看一下“JMP 105 - XML和Web Services Jumpstart”幻灯片(可以在这里找到:http://www.nnsu.com/nnsusite.nsf/xsp/.ibmmodres/domino/OpenAttachment/nnsusite.nsf/6343B286B9778CE6862576B60062BB1F/Content/JMP105.pdf),有几张幻灯片可以告诉你在哪里添加凭据。没什么好看的,你只需要将它们添加到Designer生成的存根代码中,从你想要使用的Web服务的WSDL文件中添加它们。它位于第114页的LotusScript和第120页的Java。
这解决了我的问题!!!