Object reference not set to an instance of an object for SOAP WebService in Java - java

I have created one SOAP Application to connect to QuickBooks Desktop via QuickBooksWebConnector. I have given my wsdl url to WebConnector. While calling 1st callback of authentication, connector shows me this error :
QBWC1012: Authentication failed due to following error message.
Object reference not set to an instance of an object. See QWCLog for more details. Remember to turn logging on.
Which ideally means : Object reference not set to an instance of an object.
When I am trying to execute this from SOAPUI or WebServiceExplorer, it shows correct response message as given below :
Request :
<soapenv:Envelope>
<soapenv:Body>
<q0:authenticate>
<q0:strUserName>Admin</q0:strUserName>
<q0:strPassword>Admin</q0:strPassword>
</q0:authenticate>
</soapenv:Body>
</soapenv:Envelope>
Response :
<soapenv:Envelope>
<soapenv:Body>
<authenticateResponse>
<authenticateReturn xsi:type="ns1:ArrayOfString">
<ns1:string>{57F3B9B1-86F1-4fcc-B1EE-566DE1813D20}</ns1:string>
<ns1:string>none</ns1:string>
</authenticateReturn>
</authenticateResponse>
</soapenv:Body>
</soapenv:Envelope>
(Taken from WebServiceExplorer)
As I have searched for this error : It may cause when connector gets something null or invalid in response causes this error.
How to solve this kind of error.
I am new to SOAP Webservice and also new with QuickBooks.
Thanks in advance.

Worked Solution :
I added annotation in method declaration and model class definitions to solve this kind of errors.(shown below)
Annotations for Service Declaration :
#WebService(name = "QBWebConnectorSvcSoap", targetNamespace = "http://developer.intuit.com/")
#XmlSeeAlso({
ObjectFactory.class
})
public interface QBWebConnectorSvcSoap {
#WebMethod(action = "http://developer.intuit.com/authenticate")
#WebResult(name = "authenticateResult", targetNamespace = "http://developer.intuit.com/")
#RequestWrapper(localName = "authenticate", targetNamespace = "http://developer.intuit.com/", className = "com.cantero.quickbooks.ws.Authenticate")
#ResponseWrapper(localName = "authenticateResponse", targetNamespace = "http://developer.intuit.com/", className = "com.cantero.quickbooks.ws.AuthenticateResponse")
public ArrayOfString authenticate(
#WebParam(name = "strUserName", targetNamespace = "http://developer.intuit.com/")
String strUserName,
#WebParam(name = "strPassword", targetNamespace = "http://developer.intuit.com/")
String strPassword);
//same for remaining methods
}
Annotation for Model Classes :
package com.cantero.quickbooks.ws;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
* <p>The following schema fragment specifies the expected content contained within this class.
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="strUserName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="strPassword" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*/
#XmlAccessorType(XmlAccessType.FIELD)
#XmlType(name = "", propOrder = {
"strUserName",
"strPassword"
})
#XmlRootElement(name = "authenticate")
public class Authenticate {
protected String strUserName;
protected String strPassword;
public String getStrUserName() {
return strUserName;
}
public void setStrUserName(String value) {
this.strUserName = value;
}
public String getStrPassword() {
return strPassword;
}
public void setStrPassword(String value) {
this.strPassword = value;
}
}
For more detail about what to write in these annotations[targetNamespace / webAction / XmlType] you can refer this link :
https://www.connexforquickbooks.com/qbwebservice.asmx?op=authenticate

Related

exception unmarshalling xml file using jaxb

I'm trying to unmarshall an xml file, but I get a binding exception, I'm new to using xml and schemas with java, but from what I can tell, it looks like a problem with the namespaces when it tries to bind the xml to an xsd schema I'm using.
I've been trying to work this out and I can't seem to find the issue. Thanks in advance.
This is the exception im getting:
javax.xml.bind.UnmarshalException: unexpected element (URI:"", local:"programacioAula"). Expected elements are <{http://www.xtec.cat/ProgramacioAula}programacioAula>
This is the namespaces declaration on the xml:
<programacioAula
xmlns:tns="http://www.xtec.cat/ProgramacioAula"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.xtec.cat/ProgramacioAula ProgramacioAula.xsd ">
This is the namespaces declaration on the xsd:
<schema
xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.xtec.cat/ProgramacioAula"
xmlns:tns="http://www.xtec.cat/ProgramacioAula"
elementFormDefault="unqualified"
attributeFormDefault="unqualified">
<element name="programacioAula" type="tns:ProgramacioAula"></element>
This is the pojo with the XML annotations:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.0-b52-fcs
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2015.06.04 at 10:32:59 PM CEST
//
package dani.java.model;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for ProgramacioAula complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="ProgramacioAula">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="resum" type="{http://www.xtec.cat/ProgramacioAula}Resum"/>
* <element name="unitatsFormatives" type="{http://www.xtec.cat/ProgramacioAula}UnitatsFormatives"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
#XmlAccessorType(XmlAccessType.FIELD)
#XmlType(name = "programacioAula",namespace="http://www.xtec.cat/ProgramacioAula", propOrder = {
"resum",
"unitatsFormatives"
})
#XmlRootElement(name = "programacioAula")
public class ProgramacioAula {
#XmlElement(required = true)
protected Resum resum;
#XmlElement(required = true)
protected UnitatsFormatives unitatsFormatives;
/**
* Gets the value of the resum property.
*
* #return
* possible object is
* {#link Resum }
*
*/
public Resum getResum() {
return resum;
}
/**
* Sets the value of the resum property.
*
* #param value
* allowed object is
* {#link Resum }
*
*/
public void setResum(Resum value) {
this.resum = value;
}
/**
* Gets the value of the unitatsFormatives property.
*
* #return
* possible object is
* {#link UnitatsFormatives }
*
*/
public UnitatsFormatives getUnitatsFormatives() {
return unitatsFormatives;
}
/**
* Sets the value of the unitatsFormatives property.
*
* #param value
* allowed object is
* {#link UnitatsFormatives }
*
*/
public void setUnitatsFormatives(UnitatsFormatives value) {
this.unitatsFormatives = value;
}
}
This is the method where I'm trying to unmarshall the file:
public static ProgramacioAula readXML(File file) {
ProgramacioAula programacioAula = null;
try {
JAXBContext jaxbContext = JAXBContext.newInstance(dani.java.model.ObjectFactory.class);
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
programacioAula = (ProgramacioAula) jaxbUnmarshaller.unmarshal(file);
} catch (JAXBException e) {
e.printStackTrace();
}
return programacioAula;
}
Your XML is in the default namespace:
<programacioAula
xmlns:tns="http://www.xtec.cat/ProgramacioAula"
I suspect you might need either
<tns:programacioAula
xmlns:tns="http://www.xtec.cat/ProgramacioAula"
or
<programacioAula
xmlns="http://www.xtec.cat/ProgramacioAula"

#WebResult annotation is not getting applied

I have written simple code for Soap web service in java.
I want to change the return element name to "myReturn" using #WebResult. but its not getting applied.
Below is the code snippet :
package com.mbfs.demo;
import javax.jws.WebMethod;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.ws.ResponseWrapper;
#WebService(name = "myService")
public class DemoClass {
/*#WebMethod(operationName="demo")
//#WebResult(name = "myresult", targetNamespace="http://demo.mbfs.com")
#WebResult(partName="myresult")
public String demo()
{
return "Hello World";
}
*/
#WebMethod(operationName = "")
#WebResult(name="myResult",partName="myResult")
#ResponseWrapper(localName = "getStringResponse", className =
"getStringResponse")
public String getString() {
//return "Hello World";
Demobean db = new Demobean();
db.setRet_str("Hello World");
return db.getRet_str();
}
}
I want change here
<element name="getStringResponse">
<complexType>
<sequence>
<element name="getStringReturn" type="xsd:string"/>
</sequence>
</complexType>
</element>
element name should be "myReturn".
Please help me to resolve this. By default its taking name as method name +Return.
I am using Openjdk 8 and Tomcat 7.
Let me know if it is issue with the versions.

How to consume a SOAP Web Service in Java that requires User and Password?

I'm trying to consume a SOAP web service using the NetBeans IDE (JAVA), but when I try to compile a list it returns me null.
Talking to a colleague, he told me that it is the user's network password and the company password that I work for, but I am having difficulty understanding this process, since how can I pass this information to the web service that I am consuming.
Do I have to pass this information through another method?
Below is the data for the analysis;
Web Service SOAP done in Sharepoint;
http://minha.casa.com.br/Servicos/ServicosGerais/_vti_bin/Lists.asmx?wsdl
Class where the lists are.
package vamoLA;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="listName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
#XmlAccessorType(XmlAccessType.FIELD)
#XmlType(name = "", propOrder = {
"listName"
})
#XmlRootElement(name = "GetList")
public class GetList {
protected String listName;
/**
* Gets the value of the listName property.
*
* #return
* possible object is
* {#link String }
*
*/
public String getListName() {
return listName;
}
/**
* Sets the value of the listName property.
*
* #param value
* allowed object is
* {#link String }
*
*/
public void setListName(String value) {
this.listName = value;
}
}
Class to call List.
package Wss;
import java.util.ArrayList;
import java.util.List;
import vamoLA.GetListResponse.GetListResult;
public class Testando {
private String username;
private String password;
public static void main(String[] args) {
GetListResult list = getList("T_CARDAPIO_PRATO");
List<Object> content;
content = new ArrayList<Object>();
content = list.getContent();
System.out.println("Resultado 1 " + content.get(0));
}
private static GetListResult getList(java.lang.String listName) {
vamoLA.Lists service = new vamoLA.Lists();
vamoLA.ListsSoap port = service.getListsSoap();
return port.getList(listName);
}
}
Callback.
ant -f C:\\Users\\casa\\Documents\\NetBeansProjects\\WSHell -Djavac.includes=Wss/Testando.java -Dnb.internal.action.name=run.single -Drun.class=Wss.Testando run-single
init:
Deleting: C:\Users\casa\Documents\NetBeansProjects\WSHell\build\built-jar.properties
deps-jar:
Updating property file: C:\Users\casa\Documents\NetBeansProjects\WSHell\build\built-jar.properties
wsimport-init:
wsimport-client-Lists:
files are up to date
wsimport-client-generate:
Compiling 1 source file to C:\Users\casa\Documents\NetBeansProjects\WSHell\build\classes
compile-single:
run-single:
Resultado 1 [List: null]
BUILD SUCCESSFUL (total time: 2 seconds)

Spring Soap WebService + JaxB Marshallar : Fields are missing from soap response xml

I created a Spring 3.0 webservice using soap and jaxb2marshaller for marshaling xml. I'm deploying it in wildfly server. once deployed for the first 15-20 mins all the fields specified in the response pojo is populated in the response xml. but after 15 mins all the requests made to the webservice contains responses with only one field.
Spring-servlet.xml
<bean id="MobileWebservice"
class="org.springframework.ws.wsdl.wsdl11.SimpleWsdl11Definition">
<constructor-arg value="/WEB-INF/wsdl/MobileWebservice.wsdl" />
</bean>
<bean
class="org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping">
</bean>
<bean class="org.springframework.ws.server.endpoint.adapter.MarshallingMethodEndpointAdapter">
<description>Enables the MessageDispatchServlet to invoke methods requiring OXM marshalling.</description>
<constructor-arg ref="jaxb2Marshaller"/>
</bean>
<bean id="jaxb2Marshaller"
class="org.springframework.oxm.jaxb.Jaxb2Marshaller"
scope="prototype">
<property name="contextPath"
value="com.webservice.mobilewebservice.vo" />
</bean>
I'm generating pojo's from the wsdl file and the pojo in discussion looks like this.
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2014.09.11 at 12:10:59 PM IST
//
package com.webservice.mobilewebservice.vo;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="assessmentResult" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="resultStatus" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="resultMessage" type="{http://www.w3.org/2001/XMLSchema}string"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
#XmlAccessorType(XmlAccessType.FIELD)
#XmlType(name = "", propOrder = {
"assessmentResult",
"resultStatus",
"resultMessage"
})
#XmlRootElement(name = "PerformAssessmentResponse")
public class PerformAssessmentResponse {
protected String assessmentResult;
#XmlElement(required = true)
protected String resultStatus;
#XmlElement(required = true)
protected String resultMessage;
/**
* Gets the value of the assessmentResult property.
*
* #return
* possible object is
* {#link String }
*
*/
public String getAssessmentResult() {
return assessmentResult;
}
/**
* Sets the value of the assessmentResult property.
*
* #param value
* allowed object is
* {#link String }
*
*/
public void setAssessmentResult(String value) {
this.assessmentResult = value;
}
/**
* Gets the value of the resultStatus property.
*
* #return
* possible object is
* {#link String }
*
*/
public String getResultStatus() {
return resultStatus;
}
/**
* Sets the value of the resultStatus property.
*
* #param value
* allowed object is
* {#link String }
*
*/
public void setResultStatus(String value) {
this.resultStatus = value;
}
/**
* Gets the value of the resultMessage property.
*
* #return
* possible object is
* {#link String }
*
*/
public String getResultMessage() {
return resultMessage;
}
/**
* Sets the value of the resultMessage property.
*
* #param value
* allowed object is
* {#link String }
*
*/
public void setResultMessage(String value) {
this.resultMessage = value;
}
}
This is the modified file trying to fix the issue.
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2014.09.11 at 12:10:59 PM IST
//
package com.webservice.mobilewebservice.vo;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="assessmentResult" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="resultStatus" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="resultMessage" type="{http://www.w3.org/2001/XMLSchema}string"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
#XmlType(name = "", propOrder = {
"assessmentResult",
"resultStatus",
"resultMessage"
})
#XmlRootElement(name = "PerformAssessmentResponse")
public class PerformAssessmentResponse {
protected String assessmentResult;
protected String resultStatus;
protected String resultMessage;
/**
* Gets the value of the assessmentResult property.
*
* #return
* possible object is
* {#link String }
*
*/
#XmlElement(required = false)
public String getAssessmentResult() {
return assessmentResult;
}
/**
* Sets the value of the assessmentResult property.
*
* #param value
* allowed object is
* {#link String }
*
*/
public void setAssessmentResult(String value) {
this.assessmentResult = value;
}
/**
* Gets the value of the resultStatus property.
*
* #return
* possible object is
* {#link String }
*
*/
#XmlElement(required = true)
public String getResultStatus() {
return resultStatus;
}
/**
* Sets the value of the resultStatus property.
*
* #param value
* allowed object is
* {#link String }
*
*/
public void setResultStatus(String value) {
this.resultStatus = value;
}
/**
* Gets the value of the resultMessage property.
*
* #return
* possible object is
* {#link String }
*
*/
#XmlElement(required = true)
public String getResultMessage() {
return resultMessage;
}
/**
* Sets the value of the resultMessage property.
*
* #param value
* allowed object is
* {#link String }
*
*/
public void setResultMessage(String value) {
this.resultMessage = value;
}
#Override
public String toString() {
return "PerformAssessmentResponse [assessmentResult=" + assessmentResult + ", resultStatus=" + resultStatus
+ ", resultMessage=" + resultMessage + "]";
}
}
I tried using DefaultMethodEndpointAdapter but the result is same. i couldn't find any fix.
Expeceted response.
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<ns3:PerformAssessmentResponse xmlns:ns3="http://com.mobile.service/MobileWebservice/">
<assessmentResult>true</assessmentResult>
<resultStatus>1</resultStatus>
<resultMessage>Success</resultMessage>
</ns3:PerformAssessmentResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Actual Response:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<ns3:PerformAssessmentResponse xmlns:ns3="http://com.mobile.service/MobileWebservice/">
<resultStatus>1</resultStatus>
</ns3:PerformAssessmentResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
MobileWebServiceEndpoint.java
package com.webservice.mobilewebservice.endpoint;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.zip.ZipException;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipFile;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.ws.server.endpoint.annotation.Endpoint;
import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
#Endpoint
public class MobileWebServiceEndPoint {
public static String INTERNAL_SERVER_ERROR_MESSAGE = "Internal Server Error";
#PayloadRoot(localPart = "PerformAssessmentRequest", namespace = "http://com.mobile.service/MobileWebservice/")
public PerformAssessmentResponse performAssessment(PerformAssessmentRequest request)
{
PerformAssessmentResponse response = new PerformAssessmentResponse();
try
{
byte [] requestData = request.getRequestData();
Map dataMap = new HashMap();
dataMap.put("transactionId", request.getTransactionId());
dataMap.put("requestData", requestData);
response.setResultMessage("Success");
response.setResultStatus("1");
response.setAssessmentResult("true");
}
catch(Exception lre)
{
lre.printStackTrace();
response.setResultStatus("500");
response.setResultMessage(INTERNAL_SERVER_ERROR_MESSAGE);
}
return response;
}
someone please suggest me a solution.

Call webservice using axis in java

When I would like to call webservice using Axis the request looks like this:
<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
<env:Header/>
<env:Body>
<ns2:pobierzWarunkiCenowe xmlns:ns2="http://something">
<parametryWarunkowCenowych>
<parametryWarunkuCenowego>
<KOMG-ZZPROMOCJA>KAUCYJNY</KOMG-ZZPROMOCJA>
<KOMG-KUNNR>502582</KOMG-KUNNR>
<KOMG-MATNR>TELATP00053</KOMG-MATNR>
<RV13A-DATAB>2014-04-11+02:00</RV13A-DATAB>
</parametryWarunkuCenowego>
</parametryWarunkowCenowych>
<metryka>
<uzytkownik>user</uzytkownik>
<system>system</system>
<data>2014-04-11T08:43:31.081+02:00</data>
<uid>uid</uid>
</metryka>
</ns2:pobierzWarunkiCenowe>
</env:Body>
</env:Envelope>
I try to debug this operation and I said that object is filled with correct values.
package cenniki;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for parametryWarunkowCenowych complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="parametryWarunkowCenowych">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="parametryWarunkuCenowego" type="{http://something"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
#XmlAccessorType(XmlAccessType.FIELD)
#XmlType(name = "parametryWarunkowCenowych", propOrder = {
"parametryWarunkuCenowego"
})
public class ParametryWarunkowCenowych
implements Serializable
{
private final static long serialVersionUID = 1L;
#XmlElement(required = true)
protected ParametryWarunkuCenowego parametryWarunkuCenowego;
/**
* Gets the value of the parametryWarunkuCenowego property.
*
* #return
* possible object is
* {#link ParametryWarunkuCenowego }
*
*/
public ParametryWarunkuCenowego getParametryWarunkuCenowego() {
return parametryWarunkuCenowego;
}
/**
* Sets the value of the parametryWarunkuCenowego property.
*
* #param value
* allowed object is
* {#link ParametryWarunkuCenowego }
*
*/
public void setParametryWarunkuCenowego(ParametryWarunkuCenowego value) {
this.parametryWarunkuCenowego = value;
}
}
ParametryWarunkuCenowego is not null. So why sometimes it send:
<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
<env:Header/>
<env:Body>
<ns1:pobierzWarunkiCenowe xmlns:ns1='http://something' xsi:nil='1' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'/>
</env:Body>
</env:Envelope>
Is this is ur total code for the class parametryWarunkowCenowych then u have to add the code for the inner class also as mention below for the proper conversion of the class in the xml format.
#XmlAccessorType(XmlAccessType.FIELD)
#XmlType(name = "pobierzWarunkiCenowe ", propOrder = { "data" })
public class pobierzWarunkiCenowe {
#XmlAccessorType(XmlAccessType.FIELD)
#XmlType(name = "", propOrder = { "parametryWarunkowCenowych" })
public static class parametryWarunkowCenowych {
This xml should be declared here
<KOMG-ZZPROMOCJA>KAUCYJNY</KOMG-ZZPROMOCJA>
<KOMG-KUNNR>502582</KOMG-KUNNR>
<KOMG-MATNR>TELATP00053</KOMG-MATNR>
<RV13A-DATAB>2014-04-11+02:00</RV13A-DATAB>
}
// similar way for the metryka
protected pobierzWarunkiCenowe .parametryWarunkowCenowych data;
public pobierzWarunkiCenowe .parametryWarunkowCenowych getData() {
return data;
}
public void setData(pobierzWarunkiCenowe.parametryWarunkowCenowych value) {
this.data = value;
}
}
I found the answer. In my EJB Stateless bean i get port from service in #PostConstruct method. When i move this code to the method where operation is call i can call this operation in separate ports with multiple threads.

Resources