Я пытаюсь использовать https secure wcf web service using username and password учетные данные, которые можно выполнить в .Net client.
https secure wcf web service using username and password
.Net client
Что у меня есть, я использую Netbeans 7.1, Metro 2 и Glassfish3
У меня есть wsdl, и с помощью этого wsdl я могу generate the Java stubs, но когда я запускаю клиент, он выдает ниже 100 * *
generate the Java stubs
com.sun.xml.ws.fault.ServerSOAPFaultException: Client received SOAP Fault from server: An error occurred when verifying security for the message. Please see the server log to find more detail regarding exact cuase of the failure.
Это часть политики из wsdl
<wsp:Policy wsu:Id="CustomBinding_IStandardApi_policy"> <wsp:ExactlyOne> <wsp:All> <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> <wsp:Policy> <sp:TransportToken> <wsp:Policy> <sp:HttpsToken RequireClientCertificate="false"/> </wsp:Policy> </sp:TransportToken> <sp:AlgorithmSuite> <wsp:Policy> <sp:Basic256/> </wsp:Policy> </sp:AlgorithmSuite> <sp:Layout> <wsp:Policy> <sp:Strict/> </wsp:Policy> </sp:Layout> <sp:IncludeTimestamp/> </wsp:Policy> </sp:TransportBinding> <sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> <wsp:Policy> <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient"> <wsp:Policy> <sp:WssUsernameToken10/> </wsp:Policy> </sp:UsernameToken> </wsp:Policy> </sp:SignedSupportingTokens> <sp:Wss11 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> <wsp:Policy/> </sp:Wss11> <sp:Trust10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> <wsp:Policy> <sp:MustSupportIssuedTokens/> <sp:RequireClientEntropy/> <sp:RequireServerEntropy/> </wsp:Policy> </sp:Trust10> </wsp:All> </wsp:ExactlyOne> </wsp:Policy>
Я передаю имя пользователя и пароль правильно, как указано ниже
<?xml version="1.0" encoding="utf-8"?><wsdl:definitions name="StandardApi" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:tns="http://tempuri.org/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:i0="http://cdx.dealerbuilt.com/Api/0.97/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsp1="http://www.w3.org/ns/ws-policy" xmlns:sc="http://schemas.sun.com/2006/03/wss/client" xmlns:wspp="http://java.sun.com/xml/ns/wsit/policy"><wsdl:import namespace="http://cdx.dealerbuilt.com/Api/0.97/" location="Api.svc.wsdl_wsdl0.xml"/><wsdl:types/><wsdl:binding name="CustomBinding_IStandardApi" type="i0:IStandardApi"><wsp1:PolicyReference URI="#CustomBinding_IStandardApiPolicy"/> <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/><wsdl:operation name="PullRepairOrders"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PullRepairOrders" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="PullRepairOrderByNumber"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PullRepairOrderByNumber" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="PushRepairOrders"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PushRepairOrders" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="PullAppointments"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PullAppointments" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="PushAppointments"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PushAppointments" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="CancelAppointments"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/CancelAppointments" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="UncancelAppointments"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/UncancelAppointments" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="PullCustomers"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PullCustomers" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="PullCustomerByKey"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PullCustomerByKey" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="CloseRepairOrderPayType"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/CloseRepairOrderPayType" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="PushRepairOrdersFromAppointments"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PushRepairOrdersFromAppointments" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="PushRepairOrderJobs"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PushRepairOrderJobs" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="PushRepairOrderLaborItems"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PushRepairOrderLaborItems" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="PushRepairOrderLaborOperationSublets"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PushRepairOrderLaborOperationSublets" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="PushRepairOrderParts"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PushRepairOrderParts" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="PullDealsByDealNumber"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PullDealsByDealNumber" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="GetTechnicians"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/GetTechnicians" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="PushAppraisals"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PushAppraisals" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="PullInventory"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PullInventory" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="PullInventoryByVin"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PullInventoryByVin" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="PullInventoryByStockNumber"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PullInventoryByStockNumber" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="PushInventory"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PushInventory" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="PushCustomers"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PushCustomers" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="PushCustomerVehicles"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PushCustomerVehicles" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="PullCustomerVehicles"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PullCustomerVehicles" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="PullCustomerVehiclesByCustomerKey"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PullCustomerVehiclesByCustomerKey" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="PushDeals"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PushDeals" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="PullDeals"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PullDeals" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="GetLenders"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/GetLenders" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="PushJournalEntries"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PushJournalEntries" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="PullJournalEntries"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PullJournalEntries" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="PullInventoryByVehicleKey"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PullInventoryByVehicleKey" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="PullProspects"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PullProspects" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="PullProspectByDealNumber"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PullProspectByDealNumber" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="PushProspects"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/PushProspects" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="GetServiceAdvisors"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/GetServiceAdvisors" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="GetRepairOrderJobCodes"><soap:operation soapAction="http://cdx.dealerbuilt.com/Api/0.97/IStandardApi/GetRepairOrderJobCodes" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation></wsdl:binding><wsdl:service name="StandardApi"><wsdl:port name="CustomBinding_IStandardApi" binding="tns:CustomBinding_IStandardApi"><soap:address location="https://cdx.dealerbuilt.com/0.97/Api.svc"/></wsdl:port></wsdl:service> <wsp1:Policy wsu:Id="CustomBinding_IStandardApiPolicy"> <wsp1:ExactlyOne> <wsp1:All> <sc:CallbackHandlerConfiguration wspp:visibility="private"> <sc:CallbackHandler default="test" name="usernameHandler"/> <sc:CallbackHandler default="test123" name="passwordHandler"/> </sc:CallbackHandlerConfiguration> </wsp1:All> </wsp1:ExactlyOne> </wsp1:Policy> </wsdl:definitions>
Я провел большой поиск, но не смог найти решение ..
Этот блок кода работает нормально в .Net
StandardApiClient api = new StandardApiClient(); api.ClientCredentials.UserName.UserName = "test"; api.ClientCredentials.UserName.Password = "test@123"; Customer[] result = api.PullCustomers(125);
Пожалуйста, сообщите.