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

  • Home
  • SEARCH
  • 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 6669073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:06:32+00:00 2026-05-26T03:06:32+00:00

I am attempting to consume a WCF web service from a Java client using

  • 0

I am attempting to consume a WCF web service from a Java client using JAX-WS and the Metro libraries. I have successfully generated the client using wsimport, and can open a session with the server, however the session token being returned by the service is not being set into Java’s response object. The service then returns an error when I pass a null string into endSession which sends a message that has no body content when it expects the SessionToken.

Here is the gist of my ‘main()’ method

public static void main(String[] args) {
  MyService service = new MyService()
  MyPort port = service.getBasicHttpBinding();
  EmulateRequest request = new EmulateRequest();
  request.setUnimportantProperties();
  SessionTokenResponse session = port.beginSessionAndEmulate(request);

  port.endSession(session.getSessionToken());
}

The error I am getting is that the sessionToken in the session object is null. I have determined that the sessionToken is never set. I cannot step into the beginSession method because the port is a dynamically generated proxy.

The request I am sending is this:

<?xml version='1.0' encoding='UTF-8'?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
  <S:Body>
    <EmulateRequest xmlns="http://My.Namespace">
        <UnimportantProperties>XXXX</UnimportantProperties>
    </EmulateRequest>
  </S:Body>
</S:Envelope>

And the response I receive is this:

<?xml version='1.0' encoding='UTF-8'?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
  <s:Header>
    <o:Security xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:mustUnderstand="1">
      <u:Timestamp u:Id="_0">
        <u:Created>2011-09-30T17:49:38.570Z</u:Created>
        <u:Expires>2011-09-30T17:54:38.570Z</u:Expires>
      </u:Timestamp>
    </o:Security>
  </s:Header>
  <s:Body>
    <SessionTokenResponse>
      <Errors />
      <Messages />
      <Warnings />
      <SessionToken>e579dd3e-34df-4396-ae42-1ebf03c9f301</SessionToken>
    </SessionTokenResponse>
  </s:Body>
</s:Envelope>

In the WSDL, my SessionTokenResponse object is defined as the following:

xmlns:tns="http:\\MyNamespace"

<wsdl:types>
<xs:complexType name="SessionTokenResponse">
  <xs:complexContent>
    <xs:extension base="Response">
      <xs:sequence>
        <xs:element name="SessionToken" type="xs:string" minOccurs="0"/>
      </xs:sequence>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>
<xs:complexType name="Response">
  <xs:sequence>
    <xs:element name="Errors">
      <xs:complexType>
        <xs:sequence>
          <xs:element name="Error" minOccurs="0" maxOccurs="unbounded" type="Error"/>
        </xs:sequence>
      </xs:complexType>
    </xs:element>
    <xs:element name="Messages">
      <xs:complexType>
        <xs:sequence>
          <xs:element name="Message" minOccurs="0" maxOccurs="unbounded" type="Message"/>
        </xs:sequence>
      </xs:complexType>
    </xs:element>
    <xs:element name="Warnings">
      <xs:complexType>
        <xs:sequence>
          <xs:element name="Warning" minOccurs="0" maxOccurs="unbounded" type="Warning"/>
        </xs:sequence>
      </xs:complexType>
    </xs:element>
  </xs:sequence>
</xs:complexType>
</wsdl:types>

<wsdl:message name="EmulateRequestMessage">
    <wsdl:part name="EmulateRequest" element="tns:EmulateRequest"/>
</wsdl:message>
<wsdl:message name="SessionTokenResponseMessage">
    <wsdl:part name="SessionTokenResponse" element="tns:SessionTokenResponse"/>
</wsdl:message>

<wsdl:portType msc:usingSession="false" name="MyPortName">
    <wsdl:operation name="BeginSessionAndEmulate">
        <wsdl:input wsaw:Action="http://MyNamespace/BeginSessionAndEmulate" name="EmulateRequestMessage" message="tns:EmulateRequestMessage"/>
        <wsdl:output wsaw:Action="http://MyNamespace/BeginSessionAndEmulateResponse" name="SessionTokenResponseMessage" message="tns:SessionTokenResponseMessage"/>
    </wsdl:operation>
</wsdl:portType>

<wsdl:binding name="BasicHttpBinding" type="tns:MyBindingName">
    <wsdl:operation name="BeginSessionAndEmulate">
        <wsp:PolicyReference URI="#BasicHttpBinding_policy"/>
        <wsdl:input name="EmulateRequestMessage">
            <soap:body use="literal" parts="EmulateRequest"/>
        </wsdl:input>
        <wsdl:output name="SessionTokenResponseMessage">
            <soap:body use="literal"/>
        </wsdl:output>
    </wsdl:operation>
</wsdl:binding>

<wsdl:service name="MyService">
    <wsdl:port name="BasicHttpBinding" binding="tns:BasicHttpBinding">
        <soap:address location="https://MyServiceLocation"/>
    </wsdl:port>
</wsdl:service>
/** Generated by WsImport *************************************/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SessionTokenResponse", propOrder = {
  "sessionToken"
})
public class SessionTokenResponse
    extends Response
{

  @XmlElement(name = "SessionToken")
  public String sessionToken;

  public String getSessionToken() {
      return sessionToken;
  }

  public void setSessionToken(String value) {
      this.sessionToken = value;
  }

}

There are of course other operations, but I have posted the relevant operation and types only.

Does anyone have experience with Metro enough to tell me which dumb setting I forgot?
Thanks

  • 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-26T03:06:32+00:00Added an answer on May 26, 2026 at 3:06 am

    Fixed, the web service was not providing namespace information in the response. When the response looks like the following then it works fine:

    <SessionTokenResponse xmlns="http://My.Namespace">
      <Errors />
      <Messages />
      <Warnings />
      <SessionToken>e579dd3e-34df-4396-ae42-1ebf03c9f301</SessionToken>
    </SessionTokenResponse>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JAX-RPC web service that I am attempting to consume using Spring.
I am attempting to consume an intranet web service with WCF. I added reference
I have a webservice programmed in coldfusion which I'm attempting to consume using c#.net.
A colleague of mine is attempting to consume a web service that has been
I'm attempting to gzip a JSON response from an ASMX web service to be
I am attempting to consume a web service through its corresponding wsdl. This service
I'm attempting to consume a HTTP Basic Auth Secured PHP WebService using VB.NET. I've
I'm attempting to consume a dll written in C++ from a C# application. I
I'm running Windows 7 64-bit. I'm attempting to host a WCF service which will
I have started learning WCF. I wrote a simple service to query a SQL

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.