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 7950947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:25:07+00:00 2026-06-04T02:25:07+00:00

I have a Metro client to a webservice that works fine. However, we don’t

  • 0

I have a Metro client to a webservice that works fine. However, we don’t have access to the service in our lab environment, so I wrote a mock service for testing. I’m having issues understanding endpoints and how to set them up.

I’m passing the URL into the client constructor and setting it in the request context like this:

    // Set the service port URL
    BindingProvider bindingProvider = ((BindingProvider) port);
    Map<String, Object> context = bindingProvider.getRequestContext();
    context.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serviceURL);

For my mock service, I’m using the URL of the war as given to me by Glassfish when I click on the “Launch” link in the list of applications (http://myserver:80/MySoapService).

The code has been generated from the wsdl provided to us. The WebService interface looks something like this:

@WebService(name = "My_Soap_Service", targetNamespace = "urn:My.DataEntityModel")
@XmlSeeAlso({
    ObjectFactory.class
})
public interface MySoapService {


    @WebMethod(operationName = "Ping", action = "urn:My.DataEntityModel/Ping")
    @WebResult(name = "PingResult", targetNamespace = "urn:My.DataEntityModel")
    @RequestWrapper(localName = "Ping", targetNamespace = "urn:My.DataEntityModel", className = "dataentitymodel.Ping")
    @ResponseWrapper(localName = "PingResponse", targetNamespace = "urn:My.DataEntityModel", className = "dataentitymodel.PingResponse")
    public String ping(
        @WebParam(name = "inputString", targetNamespace = "urn:My.DataEntityModel")
        String inputString);


    @WebMethod(operationName = "ProcessRecordResult", action = "urn:My.DataEntityModel/ProcessRecordResult")
    @WebResult(name = "ProcessRecordResultResult", targetNamespace = "urn:My.DataEntityModel")
    @RequestWrapper(localName = "ProcessRecordResult", targetNamespace = "urn:My.DataEntityModel", className = "dataentitymodel.ProcessRecordResult")
    @ResponseWrapper(localName = "ProcessRecordResultResponse", targetNamespace = "urn:My.DataEntityModel", className = "dataentitymodel.ProcessRecordResultResponse")
    public String ProcessRecordResult(
        @WebParam(name = "recordStatusXML", targetNamespace = "urn:My.DataEntityModel")
        String recordStatusXML);


    @WebMethod(operationName = "ProcessBatchResult", action = "urn:My.DataEntityModel/ProcessBatchResult")
    @WebResult(name = "ProcessBatchResultResult", targetNamespace = "urn:My.DataEntityModel")
    @RequestWrapper(localName = "ProcessBatchResult", targetNamespace = "urn:My.DataEntityModel", className = "dataentitymodel.ProcessBatchResult")
    @ResponseWrapper(localName = "ProcessBatchResultResponse", targetNamespace = "urn:My.DataEntityModel", className = "dataentitymodel.ProcessBatchResultResponse")
    public String processBatchResult(
        @WebParam(name = "batchStatusXML", targetNamespace = "urn:My.DataEntityModel")
        String batchStatusXML);

}

My web.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">

<web-app>
    <listener>
        <listener-class>
            com.sun.xml.ws.transport.http.servlet.WSServletContextListener </listener-class>
    </listener>
    <servlet>
        <servlet-name>MySoapService</servlet-name>
        <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>MySoapService</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>60</session-timeout>
    </session-config>
</web-app>

I’m having trouble setting up my sun-jaxws.xml file. Initially it looked like this:

<?xml version="1.0" encoding="UTF-8"?>
<endpoints
        xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime"
        version="2.0">
    <endpoint
            name="MyService"
            implementation="my.package.MySoapServiceImpl"
            url-pattern="/"
            wsdl-location="WEB-INF/wsdl/MySoapService.wsdl"/>
</endpoints>

But my client got back a “Web Services” HTML page which described the service. I haven’t been able to find any practical info/examples of sun-jaxws.xml files, but figured I needed an endpoint for each of the methods in the webservice. So I changed it to look like this:

<?xml version="1.0" encoding="UTF-8"?>
<endpoints
        xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime"
        version="2.0">
    <endpoint
            name="Ping"
            implementation="my.package.MySoapServiceImpl"
            url-pattern="/ping"
            wsdl-location="WEB-INF/wsdl/MySoapService.wsdl"/>

    <endpoint
            name="ProcessRecord"
            implementation="my.package.MySoapServiceImpl"
            url-pattern="/processRecordResult"
            wsdl-location="WEB-INF/wsdl/MySoapService.wsdl"/>

    <endpoint
            name="ProcessBatch"
            implementation="my.package.MySoapServiceImpl"
            url-pattern="/processBatchResult"
            wsdl-location="WEB-INF/wsdl/MySoapService.wsdl"/>

</endpoints>

Now I get a 404 error when my client tries to access the service.

I don’t know if I’m setting up the sun-jaxws.xml and/or web.xml files incorrectly, using the wrong URL in the client or something completely different.

Can somebody tell me what I’m doing wrong and/or point me to a resource that explains this in a easy-to-understand way?

  • 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-06-04T02:25:08+00:00Added an answer on June 4, 2026 at 2:25 am

    I got it working and in case this is useful to others, here’s my config…

    web.xml

    <web-app>
        <listener>
            <listener-class>
                com.sun.xml.ws.transport.http.servlet.WSServletContextListener </listener-class>
        </listener>
        <servlet>
            <servlet-name>MySoapService</servlet-name>
            <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet-mapping>
            <servlet-name>MySoapService</servlet-name>
            <url-pattern>/service</url-pattern>
        </servlet-mapping>
        <session-config>
            <session-timeout>60</session-timeout>
        </session-config>
    </web-app>
    

    sun-jaxws.xml

    Even though I found many examples/blogs which state that port and service elements in the sun-jaxws.xml file are optional, I couldn’t get it to work without them. Also, I found posts that state the sun-jaxws.xml file itself is optional if deploying on Glassfish. However, again I found it mandatory.

    <?xml version="1.0" encoding="UTF-8"?>
    <endpoints
            xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime"
            version="2.0">
        <endpoint
            name="MyService"
            interface="my.package.MySoapServiceInterface"
            implementation="my.package.MySoapServiceImpl"
            service="{urn:my.xmlns.tns.urn}My_Soap_Service"
            port="{urn:my.xmlns.tns.urn}My_Port_Type"
            url-pattern="/service"
            wsdl="WEB-INF/wsdl/MyService.wsdl"
    </endpoints>
    

    Web Service Impl Class

    I found it necessary to include the endpointInterface in the WebSevice annotation:

    @WebService(endpointInterface="my.package.MySoapServiceInterface")
    public class MySoapServiceImpl implements MySoapServiceInterface
    

    and of course each web service method needs to annotated with WebMethod:

    @WebMethod
    public String doSomething(String string)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have an MTOM-enabled web service that is published with Grails and the Metro
I'm trying to develop a standalone Java web service client with JAX-WS (Metro) that
I have deployed a Java metro web service that is being consumed by a
I'm trying to create a Web Service Client with Metro that uses WS-Security. I
I have used FlipView from Metro Applications and that's what I'm trying to looking
I have a StackPanel in my WinRT C# Metro app that I want to
In my Metro app, I have some code that builds up a TileWidePeekImageCollection06 (I
Using Netbeans 6.8 and metro 2.0 I have written a simple application that makes
I have this Metro App project that I just tried building for the Windows
Using VS11 RC. I have a client executable written in C++ that I am

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.