Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Issue in authenticating using SOAP Client  RSS feed

hassnain bashir
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All
I have generated Client code against WSDL document using SoapUI tool. I have Sample Request XML packet as well. When I run Sample XML request packet (includes Header Authentication and Body) It give me output. But when I run Client code in Java it is not authenticating and giving me error.
"Service request refused, client had none of the required roles".

I am pasting XML Request Packet and Client code against that as well. I am using JAX-WS.

<soapenv:Envelope xmlns:soapenv="" xmlns:ws="">
<soapenv:Header xmlns:svsec="">

* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
package com.ptcl.soap;

import java.util.logging.Level;
import java.util.logging.Logger;

import javax.xml.namespace.QName;

public class HelloClient {

public static void main(String[] args) {
SubscriberServices_Service service = null;
try {
// Creamos el servicio con el WSDL
URL wsdlLocation = new URL("http://x.x.x.x:xxx/SubscriberServices/SubscriberServices?wsdl");
String targetNamespace = "";
String name = "SubscriberServices";
service = new SubscriberServices_Service(wsdlLocation, new QName(targetNamespace, name));
SubscriberServices subscriberServices = service.getSubscriberServicesPort();

// Añadimos capacidades de seguridad a la llamada
BindingProvider provider = (BindingProvider) subscriberServices;
provider.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "******");
provider.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "******");


com.ptcl.soap.LookupSubscriberRequest request_usman = new com.ptcl.soap.LookupSubscriberRequest();

// System.out.println(request_usman.getResponseGroups().getResponseGroup());
SubscriberKey sk = new SubscriberKey();
SubscriberRealmKey subscriberRealmKey = new SubscriberRealmKey();

// request_usman.setResponseGroups();


try {
} catch (WsValidationException_Exception ex) {
Logger.getLogger(TestClient.class.getName()).log(Level.SEVERE, null, ex);
} catch (MalformedURLException e) {


Please help me in resolving this issue.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!