Salseforce Apex 类支持 Apache 轴存根身份验证
我们已将 Web 服务的 WSDL 文件转换为 salesforce apex 类。 Web 服务正在接收 Apache axis Stub 身份验证用户名和密码格式的身份验证凭据。
下面是示例 Apache axis Stub 身份验证用户名和密码代码。
Service service = new XYZServiceLocator();
URL endpointURL = new URL("https://urllink");
XYZServiceSoapBindingStub stub = new XYZServiceSoapBindingStub(endpointURL, service);
stub.setUsername("username");// void org.apache.axis.client.Stub.setUsername(String username)
stub.setPassword("password");// void org.apache.axis.client.Stub.setPassword(String Password)
QueryResponse qresp = stub.webServiceCall(qr);
我的问题是。我们可以在 salesforce Apex 类中获取 Apache axis Stub 身份验证用户名和密码功能吗?
由于 Apex Stub 支持 HTTP headers 身份验证,它是否也支持 Apache axis Stub 身份验证?
下面是 Salesforce Apex 存根 HTTP 标头身份验证代码
String myData = 'username:password';
Blob hash = Crypto.generateDigest('SHA1',Blob.valueOf(myData));
encodedusernameandpassword = EncodingUtil.base64Encode(hash);
XYZBillingStub.inputHttpHeaders_x.put('Authorization','Basic ' + encodedusernameandpassword );// SALESFORCE STUB
XYZBilling.query(queryReq )// Web Service call
请帮助我解决此问题。
We have converted a WSDL file of a Web serivice into the salesforce apex classes. The Web Service is receiving the authentication credentials in Apache axis Stub authentication username and password format.
Below is the sample Apache axis Stub authentication username and password code.
Service service = new XYZServiceLocator();
URL endpointURL = new URL("https://urllink");
XYZServiceSoapBindingStub stub = new XYZServiceSoapBindingStub(endpointURL, service);
stub.setUsername("username");// void org.apache.axis.client.Stub.setUsername(String username)
stub.setPassword("password");// void org.apache.axis.client.Stub.setPassword(String Password)
QueryResponse qresp = stub.webServiceCall(qr);
My question is. Can we get the Apache axis Stub authentication username and password functionality in the salesforce Apex classes.
As the Apex Stub support the HTTP Headers authentication does it also support the Apache axis Stub authentication?
Below is the Salesforce Apex stub HTTP Headers authentication code
String myData = 'username:password';
Blob hash = Crypto.generateDigest('SHA1',Blob.valueOf(myData));
encodedusernameandpassword = EncodingUtil.base64Encode(hash);
XYZBillingStub.inputHttpHeaders_x.put('Authorization','Basic ' + encodedusernameandpassword );// SALESFORCE STUB
XYZBilling.query(queryReq )// Web Service call
Please help me in resolving this issue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将顶点代码转换为以下代码后,我成功解决了该问题。
这是我得到的一个简单的点击和试用解决方案,我认为 Salseforce apex 功能仅支持输入 HTTP 标头身份验证过程。如果有其他方式进行身份验证,请提及。
After converting the apex code to the below code I was successfully able to resolve the issue.
This was a simple hit and trial solution I got, And I think Salseforce apex functionality only support input HTTP Headers authentication process. If one has some other way to do the authentication please mention it.
看来你已经找到解决办法了。
作为参考,请查看在在线文档的 Web 服务标注部分,用于执行基本身份验证标头。
Looks like you already figured out a solution.
For reference, have a look at the Sending HTTP Headers on a Web Service Callout section of the online docs for doing basic authentication headers.