Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

404 Error for wsdl.

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have created a small WebService using Eclipse 3.4 and Glassfish v3 prelude.
After deploying the WebService I am unable to see the wsdl through Web Browser.I am not getting the reason for it.
Is it the problem with Glassfish or I have missed out something.I have included the code below:
Using wsgen tool i have created 'MyHelloService_schema1.xsd' and 'MyHelloService.wsdl' and placed it inside 'WEB-INF' folder.
I was trying to access wsdl through this URL: http://localhost:8080/HelloWebService/MyHelloService?wsdl which gave me 404 error.
Please help me out in this.

//Service Class:
package com.hello.ws;

import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;

@WebService(name="Hello",serviceName="MyHelloService",targetNamespace="http://myws.com/hello"; )
public class Hello
{
@WebMethod(operationName="getName",action="urn:get")
@RequestWrapper(className="com.hello.ws.GetNameRequest",localName="getNameRequest",targetNamespace="http://myws.com/hello";)
@ResponseWrapper(className="com.hello.ws.GetNameResponse",localName="getNameResponse",targetNamespace="http://myws.com/hello";)
public String getHello(String name)
{
System.out.println("The name is :"+name);
return "Hello " + name + "!";
}
}

//WSDL:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.6 in JDK 6. -->
<definitions targetNamespace="http://myws.com/hello"; name="MyHelloService" xmlns="http://schemas.xmlsoap.org/wsdl/"; xmlns:tns="http://myws.com/hello"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">;
<types>
<xsd:schema>
<xsd:import namespace="http://myws.com/hello"; schemaLocation="MyHelloService_schema1.xsd"/>
</xsd:schema>
</types>
<message name="getName">
<part name="parameters" element="tns:getNameRequest"/>
</message>
<message name="getNameResponse">
<part name="parameters" element="tns:getNameResponse"/>
</message>
<portType name="Hello">
<operation name="getName">
<input message="tns:getName"/>
<output message="tns:getNameResponse"/>
</operation>
</portType>
<binding name="HelloPortBinding" type="tns:Hello">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"; style="document"/>
<operation name="getName">
<soap:operation soapAction="urn:get"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="MyHelloService">
<port name="HelloPort" binding="tns:HelloPortBinding">
<soap:address location="http://localhost:8080/HelloWebService/MyHelloService"/>;
</port>
</service>
</definitions>

Thanks ,
Ankita.
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Try putting the WSDL file and the XML schema file in a directory named "wsdl" (without quotes) in the WEB-INF directory.
By the way, GlassFish v3 final is available, in case you want to try that instead of the prelude version.
Best wishes!
 
Ankita Agarwal
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ivan,

Thanks for your reply.

I tried it by creating a directory named wsdl inside WEB-INF and redeployed the application ,but still it gives me the same error.
Is it possible that there is some problem with the server.


Thanks ,
Ankita.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Try adding wsdlLocation attribute to the @WebService annotation like,

@WebService(wsdlLocation="WEB-INF/MyHelloService.wsdl")

 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
If I remember correctly, you do not have to add "WEB-INF/wsdl/" to the wsdlLocation attribute of the @WebService annotation.
I could be wrong, but if you still have problems, you may want to examine this option.
Best wishes!
 
Ankita Agarwal
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks alot for your advices.

Nothing was working for me ,so I changed my configurations. I used Eclipse 3.5 and GlassfishServer v3 .

Now it's working fine .I am able to see my wsdl's .

Thanks ,
Ankita.
 
Ranch Hand
Posts: 341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Typically when you deploy a web service, its url shows up in Glassfish logs in Console view of Eclipse.
 
See where your hand is? Not there. It's next to this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic