Netbeans JAX-WS Client [ERROR] A class/interface with the same name
My WSDL URL is URLhttp://192.168.100.197:4443/PaymentServiceServerWS.asmx?wsdl. I want to generate java client in netbeans from the mentioned wsdl. But it gives a class/interface with the same name is already in use, use a class customization to resolve this conflict. I cant resolve this problem. But I could do it in cmd with the following comand:
wsimport http://192.168.100.197:4443/PaymentServiceServerWS.asmx?wsdl -s
D:\PROJECTS\WS\my_path -B-XautoNameResolution
After that I got all generated java code in netbeans, and trade code and got a Soap fault exception.
Just i want resolve this problem in netbeans and use customization xml file or other files to generate it ,because netbeans was unable to genare it. How can I generate this WDSL as java client without any issue?
See also questions close to this topic
-
Returning values from @Bean methods
What happens to the object I return from an @Bean method? Is there anyway to retrieve this object from another class?
-
Having Problem With Click Listener in Java
I'm making a chess-like game in java and I'm having an issue with the click events. The
mouseClicked
function isn't responding to my clicks on the window and for no apparent reason.I have already tried a few things such as changing class names and using different functions but nothing has worked.
package main.game.com; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; public class ClickEvent extends MouseAdapter { public void mouseClicked(MouseEvent e) { System.out.println("hello"); } }
package main.game.com; import java.awt.Canvas; public class Main extends Canvas { private static final long serialVersionUID = 1673528055664762143L; private static final int WIDTH = 416, HEIGHT = 439; public Main() { Window window = new Window(WIDTH, HEIGHT, "DARRAGH", this); this.addMouseListener(new ClickEvent()); }
package main.game.com; import java.awt.Canvas; import java.awt.Dimension; import javax.swing.JFrame; public class Window extends Canvas { private static final long serialVersionUID = 6733885629776844621L; public Window(int width, int height, String title, Main main) { JFrame frame = new JFrame(title); frame.setPreferredSize(new Dimension(width, height)); frame.setMaximumSize(new Dimension(width, height)); frame.setMinimumSize(new Dimension(width, height)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); frame.add(main); frame.setVisible(true); main.start(); } }
The first set of code is my
mouseAdapter
library and the second is the first part of my main class containing theclickListener
. -
JDBC choose NIC to use based on local ip address?
I'm using the PostgreSQL JDBC Driver on a machine that has multiple network cards. Only one of them has a stable connection. Is there anyway to tell JDBC to use that NIC by giving it the IP address of the NIC?
-
Maven not run projet on Tomcat 7 in Netbeans
I imported a project from GitLab. I installed apache tomcat 7 and portnado in run the project this is not performed on tomcat, but only deploy.
I tried to create a new project, and this is done correctly. The difference between these project is this:
the new projet have
Undeploying ... undeploy?path=/NewServlet OK - Undeployed application at context path /NewServlet In-place deployment at C:\Users\xxx\Desktop\mavenproject1\target\mavenproject1-1.0-SNAPSHOT Deployment is in progress... deploy?config=file%3A%2FC%3A%2FUsers%2FM6F30%7E1.MIE%2FAppData%2FLocal%2FTemp%2Fcontext7005822905571465038.xml&path=/NewServlet OK - Deployed application at context path /NewServlet Start is in progress... start?path=/NewServlet OK - Started application at context path /NewServlet
as if the deployment were not loaded on Tomcat.
I install Apche Tomcat 7.0.92 beacause the project on GitLab work with this version. But I try with apache 8 (install when i install netbeans), but the result is the same.
Help me please, i try all day, and and I could not solve. Thanks.
-
Applying background color to specific dates using jCalendar
Im trying to set specific dates in my JCalendar in a different color depending on if there is something planned for that date in my database, the date is stored as"yyyy-MM-dd" in the database, I've seen similar posts here on stackOverflow but I just cant get it to work.
I'm not sure how "component[day].setBackground(Color.green)" works like and how I can set it to only dates that has something planned for them in the database
public void kalender() { Calendar cal = Calendar.getInstance(); cal.set(Calendar.DAY_OF_MONTH, 1); int offset = cal.get(Calendar.DAY_OF_WEEK); int mon = kalender.getMonthChooser().getMonth() + 1; int yr = kalender.getYearChooser().getYear(); JPanel jPanel = kalender.getDayChooser().getDayPanel(); Component component[] = jPanel.getComponents(); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); String kalenderdatum = format.format(kalender.getDate()); System.out.println(kalenderdatum); String sql2 = "SELECT DATUM FROM MOTE"; try { Statement stmt = connection.createStatement(); ResultSet rs = stmt.executeQuery(sql2); while (rs.next()) { String datumet = rs.getString("DATUM"); String aret = datumet.substring(0, 4); int year = Integer.parseInt(aret); String manaden = datumet.substring(5,7); int month = Integer.parseInt(manaden); String dagen = datumet.substring(8,10); int day = Integer.parseInt(dagen); if(yr == year && mon == month) { component[day].setBackground(Color.green); } } } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } finally { try { } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } }
-
Background color on specific dates using JCalendar
Im trying to set specific dates in my JCalendar in a different color depending on if there is something planned for that date in my database, the date is stored as"yyyy-MM-dd" in the database, I've seen similar posts here on stackOverflow but I just cant get it to work.
I'm not sure how "component[day].setBackground(Color.green)" works like and how I can set it to only dates that has something planned for them in the database
public void kalender() { Calendar cal = Calendar.getInstance(); cal.set(Calendar.DAY_OF_MONTH, 1); int offset = cal.get(Calendar.DAY_OF_WEEK); int mon = kalender.getMonthChooser().getMonth() + 1; int yr = kalender.getYearChooser().getYear(); JPanel jPanel = kalender.getDayChooser().getDayPanel(); Component component[] = jPanel.getComponents(); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); String kalenderdatum = format.format(kalender.getDate()); System.out.println(kalenderdatum); String sql2 = "SELECT DATUM FROM MOTE"; try { Statement stmt = connection.createStatement(); ResultSet rs = stmt.executeQuery(sql2); while (rs.next()) { String datumet = rs.getString("DATUM"); String aret = datumet.substring(0, 4); int year = Integer.parseInt(aret); String manaden = datumet.substring(5,7); int month = Integer.parseInt(manaden); String dagen = datumet.substring(8,10); int day = Integer.parseInt(dagen); if(yr == year && mon == month) { component[day].setBackground(Color.green); } }
-
CXF serve static html
I'm using cxf and spring without web.xml to create a SOAP service. But for our bigIP system to work I need to serve a static HTML page with just the text OK at a given URI. I have tried to use the solution showed in https://stackoverflow.com/a/37276792/10717570 but it doesn't work for me. It just return a 404 error.
public class ClasspathResourceResolver { private String resourceLocation; private static final Logger LOG = LoggerFactory.getLogger(SFWebPort.class.getName()); public String getPath() { if (!StringUtils.isEmpty(resourceLocation)) { try { Path currentRelativePath = Paths.get(""); String s = currentRelativePath.toAbsolutePath().toString(); LOG.debug("Current relative path is: " + s); String ret = new ClassPathResource(resourceLocation).getFile().getCanonicalPath(); LOG.debug("returning: " + ret); return ret; } catch (Exception e) { LOG.warn("Unable to resolve classpath as canonical path", e); } } return null; } public void setResourceLocation(String resourceLocation) { this.resourceLocation = resourceLocation;
}
<bean name="contextHandler" class="org.eclipse.jetty.server.handler.ContextHandler"> <property name="contextPath" value="/sentralforskrivning/hsjekk"/> <property name="handler" ref="resourceHandler"/> </bean> <bean id="resourceHandler" class="org.eclipse.jetty.server.handler.ResourceHandler"> <property name="resourceBase" value="#{classpathResourceResolver.path}"/> <property name="directoriesListed" value="true"/> </bean> <bean id="classpathResourceResolver" class="com.webservice.sf.ClasspathResourceResolver"> <property name="resourceLocation" value="hsjekk.html"/> </bean> <jaxws:endpoint id="sfEndpoint" bus="cxf" implementor="com.webservice.sf.sfWebPort" address="http://localhost:${sfm.port}/sf/sfWebServiceSoapHttpPort"> <jaxws:inInterceptors> <ref bean="jwtInInterceptor"/> </jaxws:inInterceptors> </jaxws:endpoint>
Does anyone have any pointers on what I should do? And how I solve this? Thanks :)
-
How to secure a sun-jaxws java web service inside the webapp xml config files
I have a sun-jaxws xml web service:
package com.myWebservices.ws; import java.*; import javax.*; @WebService public class GetSomeInfo{ //allow IP to consume web service private static final String IP = "192.168.0.1"; @Resource WebServiceContext wsContext; @WebMethod(operationName="getSomeInfo") public String getSomeInfo(String data) { MessageContext mc = wsContext.getMessageContext(); HttpServletRequest req = (HttpServletRequest)mc.get(MessageContext.SERVLET_REQUEST); //control access by IP inside the web service code if (!(req.getRemoteAddr().equals(IP))) result = "ACCESS DENIED"; else String result = bean.executeSomeProcess(data); return result } }
The web service is protected by IP access as you can see. But the web service has public access, even if you do not obtain information only an "ACCESS DENIED", you can consume it.
I would like to know if is possible to configure the web service in their own webapp xml files configuration (WEB-INF/sun-jaxws.xml, web.xml, META-IN/context.xml, or anything..) the same protecction IP access, which rejects automatically any access to the web service that is not the same authorized IP, and nobody can even consume the web service.
Thank you.
-
Not Using com.sun Package
Recently I was working on some migration stuff. I was searching some stuff on this site. I came across a post saying com.sun package is not advisable for use. But the application that I am working on, is using the packages in quite a few places. Especially these classes:
com.sun.xml.internal.ws.handler.SOAPMessageContextImpl com.sun.xml.internal.ws.client.BindingProviderProperties
I was looking for some alternatives. Since I am on the migration process, might as well move it to something that is a "better practice"
-
TPE1122: “WS Security Header in the message is invalid.” with BulkRequestTransmitterService
We are receiving TPE1122 error message while sending a BulkRequestTransmitterService to the IRS through A2A.
I have reviewed several posts, but none of them seems to address the issue. Looks like everyone having an unique problem or maybe i just need a new set of eyes with my message header.
Can you take a look at this SOAP message and see if i am missing anything please.
<?xml version="1.0" encoding="UTF-8"?> <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"> <env:Header> <ns6:ACASecurityHeader xmlns:ns6="urn:us:gov:treasury:irs:msg:acasecurityheader" xmlns="urn:us:gov:treasury:irs:common" xmlns:ns2="http://www.w3.org/2000/09/xmldsig#" xmlns:ns3="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:ns4="urn:us:gov:treasury:irs:ext:aca:air:ty18" xmlns:ns5="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:ns7="urn:us:gov:treasury:irs:msg:irsacabulkrequesttransmitter" xmlns:ns8="urn:us:gov:treasury:irs:msg:acabusinessheader"> <UserId>[USERID]</UserId> </ns6:ACASecurityHeader> <ns5:Security xmlns:ns5="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns="urn:us:gov:treasury:irs:common" xmlns:ns2="http://www.w3.org/2000/09/xmldsig#" xmlns:ns3="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:ns4="urn:us:gov:treasury:irs:ext:aca:air:ty18" xmlns:ns6="urn:us:gov:treasury:irs:msg:acasecurityheader" xmlns:ns7="urn:us:gov:treasury:irs:msg:irsacabulkrequesttransmitter" xmlns:ns8="urn:us:gov:treasury:irs:msg:acabusinessheader"> <dsig:Signature xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" Id="Id-0001547235026109-000000002d2383e8-3"> <dsig:SignedInfo> <dsig:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> <dsig:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" /> <dsig:Reference URI="#Id-0001547235026109-000000002d2383e8-2"> <dsig:Transforms> <dsig:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> </dsig:Transforms> <dsig:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" /> <dsig:DigestValue>[VALUE]</dsig:DigestValue> </dsig:Reference> <dsig:Reference URI="#Id-0001547235026109-000000002d2383e8-1"> <dsig:Transforms> <dsig:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> </dsig:Transforms> <dsig:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" /> <dsig:DigestValue>[VALUE]</dsig:DigestValue> </dsig:Reference> </dsig:SignedInfo> <dsig:SignatureValue>[VALUE]</dsig:SignatureValue> <dsig:KeyInfo Id="Id-0001547235026109-000000002d2383e8-4"> <dsig:X509Data> <dsig:X509Certificate>[VALUE]</dsig:X509Certificate> </dsig:X509Data> </dsig:KeyInfo> </dsig:Signature> <wsu:Timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="Id-0001547235026109-000000002d2383e8-1"> <wsu:Created>2019-01-11T19:30:26Z</wsu:Created> <wsu:Expires>2019-01-11T19:40:26Z</wsu:Expires> </wsu:Timestamp> </ns5:Security> <ns8:ACABusinessHeader xmlns:ns8="urn:us:gov:treasury:irs:msg:acabusinessheader" xmlns="urn:us:gov:treasury:irs:common" xmlns:ns2="http://www.w3.org/2000/09/xmldsig#" xmlns:ns3="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:ns4="urn:us:gov:treasury:irs:ext:aca:air:ty18" xmlns:ns5="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:ns6="urn:us:gov:treasury:irs:msg:acasecurityheader" xmlns:ns7="urn:us:gov:treasury:irs:msg:irsacabulkrequesttransmitter" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="Id-0001547235026109-000000002d2383e8-2"> <ns4:UniqueTransmissionId>fec69de8-b01d-4603-b0d3-90d0e198670d:SYS12:XXXX::T</ns4:UniqueTransmissionId> <Timestamp>2018-12-11T10:13:42Z</Timestamp> </ns8:ACABusinessHeader> <ns4:ACATransmitterManifestReqDtl xmlns:ns4="urn:us:gov:treasury:irs:ext:aca:air:ty18" xmlns="urn:us:gov:treasury:irs:common" xmlns:ns2="http://www.w3.org/2000/09/xmldsig#" xmlns:ns3="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:ns5="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:ns6="urn:us:gov:treasury:irs:msg:acasecurityheader" xmlns:ns7="urn:us:gov:treasury:irs:msg:irsacabulkrequesttransmitter" xmlns:ns8="urn:us:gov:treasury:irs:msg:acabusinessheader"> <ns4:PaymentYr>2018</ns4:PaymentYr> <ns4:PriorYearDataInd>0</ns4:PriorYearDataInd> <EIN>[VALUE]</EIN> <ns4:TransmissionTypeCd>O</ns4:TransmissionTypeCd> <ns4:TestFileCd>T</ns4:TestFileCd> <ns4:TransmitterNameGrp> <ns4:BusinessNameLine1Txt>[VALUE]</ns4:BusinessNameLine1Txt> </ns4:TransmitterNameGrp> <ns4:CompanyInformationGrp> <ns4:CompanyNm>[VALUE]</ns4:CompanyNm> <ns4:MailingAddressGrp> <ns4:USAddressGrp> <ns4:AddressLine1Txt>[VALUE]</ns4:AddressLine1Txt> <CityNm>[VALUE]</CityNm> <ns4:USStateCd>[VALUE]</ns4:USStateCd> <USZIPCd>[VALUE]</USZIPCd> <USZIPExtensionCd>[VALUE]</USZIPExtensionCd> </ns4:USAddressGrp> </ns4:MailingAddressGrp> <ns4:ContactNameGrp> <ns4:PersonFirstNm>[VALUE]</ns4:PersonFirstNm> <ns4:PersonLastNm>[VALUE]</ns4:PersonLastNm> </ns4:ContactNameGrp> <ns4:ContactPhoneNum>[VALUE]</ns4:ContactPhoneNum> </ns4:CompanyInformationGrp> <ns4:VendorInformationGrp> <ns4:VendorCd>I</ns4:VendorCd> <ns4:ContactNameGrp> <ns4:PersonFirstNm>[VALUE]</ns4:PersonFirstNm> <ns4:PersonLastNm>[VALUE]</ns4:PersonLastNm> [VALUE] </ns4:ContactNameGrp> <ns4:ContactPhoneNum>[VALUE]</ns4:ContactPhoneNum> </ns4:VendorInformationGrp> <ns4:TotalPayeeRecordCnt>1</ns4:TotalPayeeRecordCnt> <ns4:TotalPayerRecordCnt>1</ns4:TotalPayerRecordCnt> <ns4:SoftwareId>[VALUE]</ns4:SoftwareId> <ns4:FormTypeCd>1094/1095B</ns4:FormTypeCd> <BinaryFormatCd>application/xml</BinaryFormatCd> <ChecksumAugmentationNum>6bc09caf95518e1af23bc8104376dde7870da3a2c139cb7644f2b924c8bf8a28</ChecksumAugmentationNum> <AttachmentByteSizeNum>15971</AttachmentByteSizeNum> <ns4:DocumentSystemFileNm>1094B_Request_XXXX_20181211T101342309Z.xml</ns4:DocumentSystemFileNm> </ns4:ACATransmitterManifestReqDtl> </env:Header> <env:Body> <ns7:ACABulkRequestTransmitter xmlns:ns7="urn:us:gov:treasury:irs:msg:irsacabulkrequesttransmitter" xmlns="urn:us:gov:treasury:irs:common" xmlns:ns2="http://www.w3.org/2000/09/xmldsig#" xmlns:ns3="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:ns4="urn:us:gov:treasury:irs:ext:aca:air:ty18" xmlns:ns5="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:ns6="urn:us:gov:treasury:irs:msg:acasecurityheader" xmlns:ns8="urn:us:gov:treasury:irs:msg:acabusinessheader"> <BulkExchangeFile> <inc:Include xmlns:inc="http://www.w3.org/2004/08/xop/include" href="cid:1094B_Request_XXXX_20181211T101342309Z.xml" /> </BulkExchangeFile> </ns7:ACABulkRequestTransmitter> </env:Body> </env:Envelope>
-
How to upload multiple files using play framework 2.6 WsClient?
This is the code for uploading Single file in as Play Documentation. Any Idea for Multiple Files?
ws.url(url) .post(Source(FilePart("hello", "hello.txt", Option("text/plain"), FileIO.fromPath(tmpFile.toPath)) :: DataPart("key", "value") :: List()))
-
How to create WSClient in Scala ?
Hello I'm writing scala code to pull the data from API. Data is paginated, so I'm pulling a data sequentially. Now, I'm looking a solution to pulling multiple page parallel and stuck to create WSClient programatically instead of Inject.
Anyone have a solution to create WSClient ?
I found a AhcWSClient(), but it required to implicitly import actor system.