Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6334189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:36:37+00:00 2026-05-24T18:36:37+00:00

I have generated a webservice client with a local wsdl using Metro 1.2 this

  • 0

I have generated a webservice client with a local wsdl using Metro 1.2 this way:

./wsimport.sh -extension -verbose -wsdllocation service.wsdl -s src -d target service.wsdl -Xendorsed

The wsdl uses SOAP 1.2 and wsHttpBinding. It’s supposed to connect to a WCF server that’s using NTLM as authentication method.

I have created an Authenticator to handle the NTLM authentication:

public class NtlmAuthenticator extends Authenticator
{
    private String username = "";
    private String password = "";

    public NtlmAuthenticator(String username, String password) {
        this.username = username;
        this.password = password;
    }

    @Override
    protected PasswordAuthentication getPasswordAuthentication() {
        return new PasswordAuthentication(username, password.toCharArray());
    }
}

Which I set before each webservice method is called:

@WebEndpoint(name = "WSHttpBinding_ICustomerService")
public ICustomerService getWSHttpBindingICustomerService() {
    ICustomerService service =
        super.getPort(new QName("http://xmlns.example.com/services/Customer",
                "WSHttpBinding_ICustomerService"), ICustomerService.class);

    NtlmAuthenticator auth = new NtlmAuthenticator(username, password);  
    Authenticator.setDefault(auth);   

    return service;
}

If I use the wrong username/password, I get a 401 Unauthorized back, which is well and all, but when I use the correct username/password, the call hangs and I never get a response!

The request looks like this (captured it with netcat, so host is different, and no https):

POST / HTTP/1.1
Content-type: application/soap+xml;charset="utf-8";action="http://xmlns.example.com/services/ICustomerService/GetCustomer"
Password: [password]
Authorization: Basic [auth]
Username: [username]
Accept: application/soap+xml, multipart/related, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
User-Agent: JAX-WS RI 2.1.7-b01-
Cache-Control: no-cache
Pragma: no-cache
Host: localhost:5500
Connection: keep-alive
Content-Length: 603

[xml follows]

I have also tried with wget 1.12 (heard that 1.11 had problem with NTLM), but it too never yields a response, just waits.

[...]
---request end---
[writing POST file customerRequest.xml ... done]
HTTP request sent, awaiting response... 

I’ve seen that others have gotten this behaviour before, but I have not been able to find out why. Can anyone shed some light on this? JDK 1.6 on linux.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T18:36:39+00:00Added an answer on May 24, 2026 at 6:36 pm

    I found that I missed a line in my generated client code that enabled Addressing and pass it to the getPort super method:

    WebServiceFeature wsAddressing = new AddressingFeature(true);
    
    ICustomerService service =
        super.getPort(new QName("http://xmlns.example.com/services/Customer",
                "WSHttpBinding_ICustomerService"), ICustomerService.class, 
                wsAddressing);
    

    Why metro didn’t generate this is beyond me. The method looked like this in the end:

    @WebEndpoint(name = "WSHttpBinding_ICustomerService")
    public ICustomerService getWSHttpBindingICustomerService() {
        WebServiceFeature wsAddressing = new AddressingFeature(true);
    
        ICustomerService service =
            super.getPort(new QName("http://xmlns.example.com/services/Customer",
                    "WSHttpBinding_ICustomerService"), ICustomerService.class, 
                    wsAddressing);
    
        NtlmAuthenticator auth = new NtlmAuthenticator(username, password);  
        Authenticator.setDefault(auth);   
    
        return service;
    }
    

    This in turn added a SOAP header to the message:

    <S:Header>
      <To xmlns="http://www.w3.org/2005/08/addressing">https://services.example.com/CustomerService.svc</To>
      <Action xmlns="http://www.w3.org/2005/08/addressing">http://xmlns.example.com/services/ICustomerService/GetCustomer</Action>
      <ReplyTo xmlns="http://www.w3.org/2005/08/addressing">
        <Address>http://www.w3.org/2005/08/addressing/anonymous</Address>
      </ReplyTo>
      <MessageID xmlns="http://www.w3.org/2005/08/addressing">uuid:d33c2888-abfa-474d-8729-95d2bcd17a96</MessageID>
    </S:Header>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All the generated webservice-stubs from our backend have an equals-method similar to this one:
I have hard times using maven to generate my web service client. So please
I have a webservice that I'm using JAX-WS annotations to generate the WSDL &
Using code that was generated with wsimport , can the service endpoint be overridden
I have some types which are generated by a web service reference. I want
I have a web service protected by HTTPS with NTLM authentication and I generated
I have a simple web service call, generated by a .NET (C#) 2.0 Windows
I have an WSDL / Web Service and I need to generate an set
I have generated a C# SharePoint Sequential Workflow project using the very handy STSDEV
I have generated using openssl mycert.pem which contents the certificate. And I converted the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.