I don't get why you need to create a service and add the port. You already created service and get endpoint port with:
*EmployeeService_Service employeeServiceService = new EmployeeService_Service(url);* *com.example.jaxws.ws.EmployeeService employeeServiceProxy = employeeServiceService.getEmployeeServiceImplPort();* You can directly use EmployeeService to call remote ws endpoint. On Tue, Nov 21, 2023 at 11:46 PM Mark Streit <mcs...@gmail.com> wrote: > Thanks for getting back to me… > > It’s not with the tools. It occurs when trying to run a test client > program that makes JAX-WS call > > Exception info and code block are below. > > Hopefully this helps answer your question > > > > Connected to the target VM, address: '127.0.0.1:57317', transport: > 'socket' > > SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". > > SLF4J: Defaulting to no-operation (NOP) logger implementation > > SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further > details. > > Nov 20, 2023 4:32:49 PM > org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean > buildServiceFromWSDL > > INFO: Creating Service {http://ws.jaxws.example.com/}EmployeeService from > WSDL:http://localhost:8080/employee-service/EmployeeService?wsdl > > employeeServiceService: > com.example.jaxws.ws.EmployeeService_Service@6e0ff644 > > employeeServiceProxy: org.apache.cxf.jaxws.JaxWsClientProxy@5949eba8 > > Nov 20, 2023 4:33:03 PM > org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean > buildServiceFromClass > > INFO: Creating Service { > http://localhost:8080/employee-service/EmployeeService}EmployeeService from > class com.example.jaxws.ws.EmployeeService > > Nov 20, 2023 4:33:03 PM > org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean > buildServiceFromClass > > INFO: Creating Service { > http://localhost:8080/employee-service/EmployeeService}EmployeeService from > class com.example.jaxws.ws.EmployeeService > > Nov 20, 2023 4:36:48 PM org.apache.cxf.phase.PhaseInterceptorChain > doDefaultLogging > > > > *WARNING: Interceptor for > {http://localhost:8080/employee-service/EmployeeService}EmployeeService#{http://ws.jaxws.example.com/}getEmployee > <http://localhost:8080/employee-service/EmployeeService%7DEmployeeService#%7Bhttp://ws.jaxws.example.com/%7DgetEmployee> > has > thrown exception, unwinding now* > > *java.lang.NullPointerException: Cannot invoke > "org.apache.cxf.transport.http.Address.getURI()" because "address" is null* > > at > org.apache.cxf.transport.http.HttpClientHTTPConduit.setupConnection(HttpClientHTTPConduit.java:161) > > at > org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:551) > > at > org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:47) > > at > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307) > > at > org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:528) > > at > org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:439) > > at > org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:354) > > at > org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:312) > > at > org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96) > > at > org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:140) > > at jdk.proxy2/jdk.proxy2.$Proxy34.getEmployee(Unknown > Source) > > * at > com.example.jaxws.ws.client.WSClient.main(WSClient.java:49) —> **TEST > CLIENT APP W/ A main() method – error triggered on this line 49 – see code > below * > > > > jakarta.xml.ws.WebServiceException: java.lang.NullPointerException: Cannot > invoke "org.apache.cxf.transport.http.Address.getURI()" because "address" > is null > > at > org.apache.cxf.jaxws.JaxWsClientProxy.mapException(JaxWsClientProxy.java:193) > > at > org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:145) > > at jdk.proxy2/jdk.proxy2.$Proxy34.getEmployee(Unknown > Source) > > at > com.example.jaxws.ws.client.WSClient.main(WSClient.java:49) > > Caused by: java.lang.NullPointerException: Cannot invoke > "org.apache.cxf.transport.http.Address.getURI()" because "address" is null > > at > org.apache.cxf.transport.http.HttpClientHTTPConduit.setupConnection(HttpClientHTTPConduit.java:161) > > at > org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:551) > > at > org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:47) > > at > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307) > > at > org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:528) > > at > org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:439) > > at > org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:354) > > at > org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:312) > > at > org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96) > > at > org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:140) > > ... 2 more > > Disconnected from the target VM, address: '127.0.0.1:57317', transport: > 'socket' > > > > > > *TEST CODE BEING USED* > > > > package com.example.jaxws.ws.client; > > import com.example.jaxws.ws.Employee; > import com.example.jaxws.ws.EmployeeService_Service; > import jakarta.xml.ws.Service; > import jakarta.xml.ws.soap.SOAPBinding; > import org.apache.logging.log4j.LogManager; > import org.apache.logging.log4j.Logger; > > import javax.xml.namespace.QName; > import java.net.MalformedURLException; > import java.net.URL; > > > public final class WSClient { > private static final Logger *logger *= LogManager.*getLogger* > (WSClient.class); > private static URL *url*; > > static { > try { > *url *= new URL(" > http://localhost:8080/employee-service/EmployeeService?wsdl"); > } catch (MalformedURLException e) { > throw new RuntimeException(e); > } > } > //private static QName qName = new QName(" > http://localhost:8080/employee-service/EmployeeService"); > > private static final QName > *SERVICE_NAME *= new QName(" > http://localhost:8080/employee-service/EmployeeService", > "EmployeeService"); > private static final QName > *PORT_NAME *= new QName(" > http://localhost:8080/employee-service/EmployeeService", > "EmployeeServicePort"); > WSClient() { > > } > > public static void main(String[] args) { > try { > > > EmployeeService_Service employeeServiceService = new > EmployeeService_Service(*url*); > com.example.jaxws.ws.EmployeeService employeeServiceProxy = > employeeServiceService.getEmployeeServiceImplPort(); > System.*out*.println("employeeServiceService: " + > employeeServiceService.toString()); > System.*out*.println("employeeServiceProxy: " + > employeeServiceProxy.toString()); > Service service = Service.*create*(*SERVICE_NAME*); > String endpointAddress = " > http://localhost:8080/employee-service/EmployeeService"; > service.addPort(*PORT_NAME*, SOAPBinding.*SOAP11HTTP_BINDING*, > endpointAddress); > > com.example.jaxws.ws.EmployeeService employeeService = > service.getPort(com.example.jaxws.ws.EmployeeService.class); > *Employee employee = employeeService.getEmployee(9000);* —> > Exception > is triggered as soon as an attempt to call the method on the Proxy instance… > this is line 49 in the stacktrace > System.*out*.println("com.example.jaxws.ws.Employee:" + > employee.toString()); > > } catch (Exception e) { > e.printStackTrace(); > } > } > > } > > > > > > > > On Mon, Nov 20, 2023 at 21:45 Jim Ma <mail2ji...@gmail.com> wrote: > >> When does this error happen? Still in code generation with cxf tools ? >> It seems this is generated from the java classes instead of from the wsdl >> file . Did you pass the correct wsdl url to the cxf tool ? >> >> >> On Mon, Nov 20, 2023 at 11:57 AM Mark Streit <mcs...@gmail.com> wrote: >> >>> Jim Ma >>> >>> Many THANKS for pointing this out. Indeed, when I removed the original >>> entry that was entangled in Metro JAX-WS and replaced w/ the CXF >>> dependency.... *it processed MUCH farther*. Instead of failing where >>> it was originally trying to find a "Provider", it now passes much further >>> to the point of NOW making the call attempt but I am still seeing it error >>> in a different place in the code... >>> >>> Nov 19, 2023 10:42:16 PM >>> org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean >>> buildServiceFromClass >>> >>> INFO: Creating Service { >>> http://localhost:8080/employee-service/EmployeeService}EmployeeService from >>> class com.example.jaxws.ws.EmployeeService >>> >>> Nov 19, 2023 10:42:16 PM >>> org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean >>> buildServiceFromClass >>> >>> INFO: Creating Service { >>> http://localhost:8080/employee-service/EmployeeService}EmployeeService from >>> class com.example.jaxws.ws.EmployeeService >>> >>> Nov 19, 2023 10:42:16 PM org.apache.cxf.phase.PhaseInterceptorChain >>> doDefaultLogging >>> >>> WARNING: Interceptor for { >>> http://localhost:8080/employee-service/EmployeeService}EmployeeService#{http://ws.jaxws.example.com/}getEmployee >>> has >>> thrown exception, unwinding now >>> >>> java.lang.NullPointerException: Cannot invoke >>> "org.apache.cxf.transport.http.Address.getURI()" because "address" is null >>> >>> at >>> org.apache.cxf.transport.http.HttpClientHTTPConduit.setupConnection(HttpClientHTTPConduit.java:161) >>> >>> at >>> org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:551) >>> >>> >>> >>> I have resumed a Google hunt for the error message shown above, but have >>> yet to find anything concrete beyond the fact that this error has been seen >>> by others ... >>> >>> This is the furthest I have been able to get the test client to go so *thank >>> you* immensely for the valuable tip regarding the dependency change... >>> I was fighting with the original Provider issue for over a week making >>> countless changes with no success... >>> >>> >>> Mark >>> >>> >>> >>> >>> On Sun, Nov 12, 2023 at 8:10 PM Jim Ma <mail2ji...@gmail.com> wrote: >>> >>>> Your pom has the metro and this is problematic to work with CXF's tool. >>>> Please replace this dependency with CXF's. >>>> <dependency> >>>> >>>> <groupId>com.sun.xml.ws</groupId> >>>> <artifactId>rt</artifactId> >>>> <version>2.3.2</version> >>>> <scope>runtime</scope> >>>> </dependency> >>>> >>>> >>>> On Sat, Nov 11, 2023 at 9:35 AM Mark Streit <mcs...@gmail.com> wrote: >>>> >>>> > Hello All >>>> > >>>> > I'm fairly well-versed in JAX-WS web services going back to the days >>>> of the >>>> > original JSR-224 spec and the "Sun Metro" JAX-WS RT and API stack. I >>>> have >>>> > not used JAX-WS services and tools since we moved to Spring Boot >>>> > around 2016. I'm now finding myself working on a project that uses >>>> WildFly >>>> > (v27 specifically) and SOAP web services. >>>> > >>>> > While doing a very simple POC exercise, I have a JAX-WS web service >>>> > packaged in a WAR (build w/ Maven) and deployed and running on >>>> WildFly - no >>>> > issues there. I can get back the WSDL document from the "running" >>>> service >>>> > on port 8080. (A default standard instance of WildFly running - *JDK >>>> 17 >>>> > Corretto)*. I've also discovered that the tools in WildFly (such as >>>> > *wsconsume* to generate java artifacts, *are using CXF* under the >>>> hood - >>>> > "wsdl2Java"?). >>>> > >>>> > >>>> > **** This class was generated by Apache CXF 3.5.2-jbossorg-4* >>>> > >>>> > Hence I'm taking a longshot chance asking this question here as I've >>>> been >>>> > struggling to get a JAX-WS Client built that will run from a simple >>>> Java >>>> > standalone code block w/ a main(). Nothing more complex than that. I >>>> have >>>> > posted the issue to the Stackoverflow forum to see if anyone has seen >>>> > something similar. >>>> > >>>> > 1) the client code is extremely simple and is attempted to be run from >>>> > inside the IntelliJ IDE. >>>> > 2) I have debugged the client code stepping into the code where it >>>> blows >>>> > apart w/ the message seen below. >>>> > >>>> > >>>> > >>>> java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) >>>> > >>>> > at >>>> > >>>> java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) >>>> > >>>> > at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) >>>> > >>>> > at java.base/java.lang.Class.forName0(Native Method) >>>> > >>>> > at java.base/java.lang.Class.forName(Class.java:375) >>>> > >>>> > at jakarta.xml.ws.spi.FactoryFinder.isOsgi(FactoryFinder.java:214) >>>> > >>>> > at jakarta.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:124) >>>> > >>>> > at jakarta.xml.ws.spi.Provider.provider(Provider.java:64) >>>> > >>>> > at jakarta.xml.ws.Service.<init>(Service.java:82) >>>> > >>>> > at jakarta.xml.ws.Service.create(Service.java:735) >>>> > >>>> > at com.example.jaxws.ws.client.WSClient.main(WSClient.java:21) >>>> > >>>> > jakarta.xml.ws.WebServiceException: Unable to createEndpointReference >>>> > Provider >>>> > >>>> > at jakarta.xml.ws.spi.Provider.provider(Provider.java:68) >>>> > >>>> > at jakarta.xml.ws.Service.<init>(Service.java:82) >>>> > >>>> > at jakarta.xml.ws.Service.create(Service.java:735) >>>> > >>>> > at com.example.jaxws.ws.client.WSClient.main(WSClient.java:21) >>>> > >>>> > Caused by: java.lang.ClassCastException: class >>>> > com.sun.xml.ws.spi.ProviderImpl cannot be cast to class >>>> > jakarta.xml.ws.spi.Provider (com.sun.xml.ws.spi.ProviderImpl and >>>> > jakarta.xml.ws.spi.Provider are in unnamed module of loader 'app') >>>> > >>>> > at jakarta.xml.ws.spi.Provider.provider(Provider.java:64) >>>> > >>>> > >>>> > *Everything is described on this >>>> > post >>>> > >>>> https://stackoverflow.com/questions/77456843/jax-ws-web-service-client-jdk-17-simple-java-client-w-a-main-fails >>>> > < >>>> > >>>> https://stackoverflow.com/questions/77456843/jax-ws-web-service-client-jdk-17-simple-java-client-w-a-main-fails >>>> > > >>>> > The post includes the relevant Java code blocks and the pom.xml >>>> content. * >>>> > >>>> > >>>> > 3) The client code was built w/ Maven using a terminal window and >>>> typical >>>> > mvn clean install -U >>>> > 4) A JAR file is created - when you right-click and run it from >>>> inside the >>>> > IDE, it finds main() and hits the breakpoints as expected... >>>> > >>>> > It's clearly a runtime classpath problem or mistake that is causing >>>> the >>>> > issue and I have spent hours changing attributes in the pom.xml, >>>> adjusting >>>> > the "Run Configuration" within IntelliJ --- all to simply land on >>>> the same >>>> > Exception when it tries to create the proxy object for the client side >>>> > call. >>>> > >>>> > There have been many posts re: the repackaging of the JAX-WS >>>> components >>>> > from "javax" to "jakartaee" following the release of JDK 7 or 8 *and >>>> > onward*. >>>> > It's not clear that this has anything to do with it since compile time >>>> > building is always successful. >>>> > >>>> > While I don't suspect this is a "CXF Problem" directly, I am hoping >>>> someone >>>> > may be familiar w/ such an exception. >>>> > >>>> > >>>> > Thanks for any input >>>> > >>>> > Mark >>>> > >>>> >>>