title: javax.xml.ws.WebServiceException: Undefined port type Java Struts SOAP WSDL
body: <p>ok I have really a strange problem that I keep looking for solution in google and yahoo for almost 4 hours today. And I desperately looking for a solution.</p>
  
  <pre><code>public static String [] checkCardAccount(String cardNumber, String cardIssuer, String securityNumber){
  
          URL url = null;
          try {
              url = new URL("http://localhost:8999/bankcard?wsdl");
          } catch (MalformedURLException e) {
              e.printStackTrace();
          }
  
          QName qname = new QName("http://server.bcard.soap.com/","BankCardImplService");
  
          Service service = Service.create(url,qname);
  
          BankCard bankcard = service.getPort(BankCard.class);
  
          return bankcard.getCardClientData(cardNumber, cardIssuer);
      }
  </code></pre>
  
  <p>the above code is my client for accessing the SOAP service, it really works in a standalone java application but when I embed it to my Java Struts application it says the following error below</p>
  
  <blockquote>
    <p>javax.xml.ws.WebServiceException: Undefined port type:
    {http://bankcard.api.com/}BankCard    at
    com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:349)
      at
    com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:355)
      at javax.xml.ws.Service.getPort(Service.java:161)   at
    com.api.bankcard.BankCardClient.checkCardAccount(BankCardClient.java:25)
      at com.action.CardregAction.execute(CardregAction.java:18)  at
    org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
      at
    org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
      at
    org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
      at
    org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
      at
    org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305)
      at
    org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
      at
    org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
      at
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
      at
    org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)     at
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)  at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
      at
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
      at
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
      at
    org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
      at java.lang.Thread.run(Thread.java:662)</p>
  </blockquote>
  
  <p>Now I really see that the problem is the target namespace because as I change it the error changes to that it says that the valid services is <code>{http://bankcard.api.com/}BankCard</code> </p>
  
  <p>where I went wrong? this code works on standalone on Java Application but not in my Java Struts web app</p>