Skip to content

Commit

Permalink
HelloWorld ex03.3
Browse files Browse the repository at this point in the history
  • Loading branch information
milo1393 committed Jan 18, 2022
1 parent 57f36f6 commit acc59e3
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 8 deletions.
40 changes: 40 additions & 0 deletions EX3/rest/src/main/java/helloworld/HelloWorld.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package helloworld;

import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.Application;
import jakarta.ws.rs.core.MediaType;

@Path("/hello")
public class HelloWorld extends Application {
@GET
@Produces(MediaType.TEXT_HTML)
public String getDataHTML() {
return """
<html>
<head></head>
<body>Hello World (HTML text)!!!</body>
</html>
""";
}

@GET
@Produces(MediaType.TEXT_PLAIN)
public String getDataPlain() {
return "Hello World (plain text)";
}
@GET
@Path("/xml")
@Produces(MediaType.TEXT_XML)
public String getDataXML() {
return "<helloworld.HelloWorld>Hello World (XML text)!!!</helloworld.HelloWorld>";
}
@GET
@Path("/json")
@Produces(MediaType.APPLICATION_JSON)
public String getDataJSON() {
return "{\"val\":\"helloworld.HelloWorld\"}";
}

}
16 changes: 8 additions & 8 deletions EX3/soap/client/src/main/resources/HelloWorld.wsdl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?><!-- Published by JAX-WS RI (https://github.com/eclipse-ee4j/metro-jax-ws). RI's version is JAX-WS RI 3.0.2 git-revision#91dd558. --><!-- Generated by JAX-WS RI (https://github.com/eclipse-ee4j/metro-jax-ws). RI's version is JAX-WS RI 3.0.2 git-revision#91dd558. --><definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://hello/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://hello/" name="HelloWorldService">
<types>
<xsd:schema>
<xsd:import namespace="http://hello/" schemaLocation="http://localhost:8081/HelloWorld?xsd=1"/>
<xsd:import namespace="http://hello/" schemaLocation="http://localhost:8081/helloworld.HelloWorld?xsd=1"/>
</xsd:schema>
</types>
<message name="saySomething">
Expand All @@ -16,17 +16,17 @@
<message name="getDataResponse">
<part name="parameters" element="tns:getDataResponse"/>
</message>
<portType name="HelloWorld">
<portType name="helloworld.HelloWorld">
<operation name="saySomething">
<input wsam:Action="http://hello/HelloWorld/saySomethingRequest" message="tns:saySomething"/>
<output wsam:Action="http://hello/HelloWorld/saySomethingResponse" message="tns:saySomethingResponse"/>
<input wsam:Action="http://hello/helloworld.HelloWorld/saySomethingRequest" message="tns:saySomething"/>
<output wsam:Action="http://hello/helloworld.HelloWorld/saySomethingResponse" message="tns:saySomethingResponse"/>
</operation>
<operation name="getData">
<input wsam:Action="http://hello/HelloWorld/getDataRequest" message="tns:getData"/>
<output wsam:Action="http://hello/HelloWorld/getDataResponse" message="tns:getDataResponse"/>
<input wsam:Action="http://hello/helloworld.HelloWorld/getDataRequest" message="tns:getData"/>
<output wsam:Action="http://hello/helloworld.HelloWorld/getDataResponse" message="tns:getDataResponse"/>
</operation>
</portType>
<binding name="HelloWorldPortBinding" type="tns:HelloWorld">
<binding name="HelloWorldPortBinding" type="tns:helloworld.HelloWorld">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="saySomething">
<soap:operation soapAction=""/>
Expand All @@ -49,7 +49,7 @@
</binding>
<service name="HelloWorldService">
<port name="HelloWorldPort" binding="tns:HelloWorldPortBinding">
<soap:address location="http://localhost:8081/HelloWorld"/>
<soap:address location="http://localhost:8081/helloworld.HelloWorld"/>
</port>
</service>
</definitions>

0 comments on commit acc59e3

Please sign in to comment.