Link to home
Start Free TrialLog in
Avatar of thomasbau65
thomasbau65

asked on

Web Service Java Client getting null

Hi All
I'm stuck with following problem:

I have a web-service
@WebService(serviceName = "BSOManagement", portName = "BsoServiceEndPoint", endpointInterface = "services.ch.mobcomp.BSOManagementSC", targetNamespace = "urn:mobcomp.ch.services", wsdlLocation = "WEB-INF/wsdl/NewWebServiceFromWSDL/mobcomp.ch.services.wsdl")
public class NewWebServiceFromWSDL {

    public services.ch.mobcomp.ActResponse getAct(services.ch.mobcomp.GetActRequest parameters) throws BSOManagementSCGetActGenericFaultFaultFaultMessage {
        services.ch.mobcomp.ObjectFactory serviceObjFactory = new services.ch.mobcomp.ObjectFactory();
        services.ch.mobcomp.ActResponse response = serviceObjFactory.createActResponse();
        
        model.services.ch.mobcomp.ObjectFactory factory = new model.services.ch.mobcomp.ObjectFactory();
        
        Act act = new Act();
        act.setAccessRight(AccessRight.NONE);
        
        act.setCatCode(factory.createCatCodesCatCode2("CATCODE"));
        
        act.setCreatorId(new BigDecimal(100));
        act.setNameTxt("SOME Action Name");
        
        ActOutput out = new ActOutput();
        out.setAct(act);
        
        response.setAct(factory.createActOutput(out));
        return response;
    }
    
}

Open in new window


which I can call using web browser. The Service is sending back correct data.
SOAP Request

    <?xml version="1.0" encoding="UTF-8"?>
    <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
        <S:Header/>
        <S:Body>
            <ns4:GetActRequest xmlns="urn:mobcomp.ch.services.fault" xmlns:ns2="urn:mobcomp.ch.services.filter" xmlns:ns3="urn:mobcomp.ch.services.model" xmlns:ns4="urn:mobcomp.ch.services" xmlns:ns5="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
        </S:Body>
    </S:Envelope>

SOAP Response

    <?xml version="1.0" encoding="UTF-8"?>
    <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
        <S:Body>
            <ns4:ActResponse xmlns="urn:mobcomp.ch.services.fault" xmlns:ns2="urn:mobcomp.ch.services.filter" xmlns:ns3="urn:mobcomp.ch.services.model" xmlns:ns4="urn:mobcomp.ch.services" xmlns:ns5="http://schemas.microsoft.com/2003/10/Serialization/">
                <ns3:ActOutput>
                    <ns3:Act>
                        <ns3:CreatorId>100</ns3:CreatorId>
                        <ns3:CatCode2>CATCODE</ns3:CatCode2>
                        <ns3:NameTxt>SOME Action Name</ns3:NameTxt>
                        <ns3:AccessRight>None</ns3:AccessRight>
                    </ns3:Act>
                </ns3:ActOutput>
            </ns4:ActResponse>
        </S:Body>
    </S:Envelope>

Open in new window


On the other hand, when calling the service using the a Java client
 
dummy.BSOManagement proxy1 = new dummy.BSOManagement();
        dummy.BSOManagementSC service1 = proxy1.getBsoServiceEndPoint();
        try {
            dummy.ActResponse res = service1.getAct(null);
            if(res != null)
            {
                JAXBElement<dummy.ActOutput> output = res.getAct();
            }
        } catch (dummy.BSOManagementSCGetActGenericFaultFaultFaultMessage ex) {
            Logger.getLogger(BSOManagementClient.class.getName()).log(Level.SEVERE, null, ex);
        }

Open in new window


the "res.getAct()" method always return null

Any idea?
Avatar of regevha
regevha

Please attach the WSDL file
Avatar of thomasbau65

ASKER

here the wsdl

 
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:tns="urn:mobcomp.ch.services" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="BSOManagement" targetNamespace="urn:mobcomp.ch.services" xmlns:wsp1="http://www.w3.org/ns/ws-policy" xmlns:fi="http://java.sun.com/xml/ns/wsit/2006/09/policy/fastinfoset/service" xmlns:tcp="http://java.sun.com/xml/ns/wsit/2006/09/policy/soaptcp/service">
	<wsdl:types>
		<xsd:schema targetNamespace="urn:mobcomp.ch.services/Imports">
			<xsd:import schemaLocation="mobcomp.ch.services.xsd" namespace="urn:mobcomp.ch.services"/>
			<xsd:import schemaLocation="mobcomp.ch.services.fault.xsd" namespace="urn:mobcomp.ch.services.fault"/>
			<xsd:import schemaLocation="schemas.microsoft.com.2003.10.Serialization.xsd" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
			<xsd:import schemaLocation="mobcomp.ch.services.filter.xsd" namespace="urn:mobcomp.ch.services.filter"/>
			<xsd:import schemaLocation="mobcomp.ch.services.model.xsd" namespace="urn:mobcomp.ch.services.model"/>
		</xsd:schema>
	</wsdl:types>

	<wsdl:message name="ObjItemResponse">
		<wsdl:part name="parameters" element="tns:ObjItemResponse"/>
	</wsdl:message>
	
	<wsdl:message name="ActResponse">
		<wsdl:part name="parameters" element="tns:ActResponse"/>
	</wsdl:message>
	
	<wsdl:message name="GetActRequest">
		<wsdl:part name="parameters" element="tns:GetActRequest"/>
	</wsdl:message>
	<wsdl:message name="BSOManagementSC_GetAct_GenericFaultFault_FaultMessage">
		<wsdl:part name="detail" element="q6:GenericFault" xmlns:q6="urn:mobcomp.ch.services.fault"/>
	</wsdl:message>
	<wsdl:message name="GetObjItemRequest">
		<wsdl:part name="parameters" element="tns:GetObjItemRequest"/>
	</wsdl:message>
	<wsdl:message name="BSOManagementSC_GetObjItem_GenericFaultFault_FaultMessage">
		<wsdl:part name="detail" element="q7:GenericFault" xmlns:q7="urn:mobcomp.ch.services.fault"/>
	</wsdl:message>
	<wsdl:portType name="BSOManagementSC">
		<wsdl:operation name="GetAct">
			<wsdl:input name="GetActRequest" message="tns:GetActRequest" wsaw:Action="GetAct"/>
			<wsdl:output name="ActResponse" message="tns:ActResponse" wsaw:Action="urn:mobcomp.ch.services/BSOManagementSC/GetActResponse"/>
			<wsdl:fault name="GenericFaultFault" message="tns:BSOManagementSC_GetAct_GenericFaultFault_FaultMessage" wsaw:Action="urn:mobcomp.ch.services/BSOManagementSC/GetActGenericFaultFault"/>
		</wsdl:operation>
		<wsdl:operation name="GetObjItem">
			<wsdl:input name="GetObjItemRequest" message="tns:GetObjItemRequest" wsaw:Action="GetObjItem"/>
			<wsdl:output name="ObjItemResponse" message="tns:ObjItemResponse" wsaw:Action="urn:mobcomp.ch.services/BSOManagementSC/GetObjItemResponse"/>
			<wsdl:fault name="GenericFaultFault" message="tns:BSOManagementSC_GetObjItem_GenericFaultFault_FaultMessage" wsaw:Action="urn:mobcomp.ch.services/BSOManagementSC/GetObjItemGenericFaultFault"/>
		</wsdl:operation>
	</wsdl:portType>
	<wsdl:binding name="BsoServiceEndPoint" type="tns:BSOManagementSC">
	 <wsp:PolicyReference URI="#BsoServiceEndPointPolicy"/>
	 <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
		<wsdl:operation name="GetAct">
			<soap:operation soapAction="GetAct" style="document"/>
			<wsdl:input name="GetActRequest">
				<soap:body use="literal"/>
			</wsdl:input>
			<wsdl:output name="ActResponse">
				<soap:body use="literal"/>
			</wsdl:output>
			<wsdl:fault name="GenericFaultFault">
				<soap:fault name="GenericFaultFault" use="literal"/>
			</wsdl:fault>
		</wsdl:operation>
		<wsdl:operation name="GetObjItem">
			<soap:operation soapAction="GetObjItem" style="document"/>
			<wsdl:input name="GetObjItemRequest">
				<soap:body use="literal"/>
			</wsdl:input>
			<wsdl:output name="ObjItemResponse">
				<soap:body use="literal"/>
			</wsdl:output>
			<wsdl:fault name="GenericFaultFault">
				<soap:fault name="GenericFaultFault" use="literal"/>
			</wsdl:fault>
		</wsdl:operation>
	</wsdl:binding>
	<wsdl:service name="BSOManagement">
		<wsdl:port name="BsoServiceEndPoint" binding="tns:BsoServiceEndPoint">
			<soap:address location="http://server:port/MCP/BsoService.svc"/>
		</wsdl:port>
	</wsdl:service>
 <wsp:Policy wsu:Id="BsoServiceEndPointPolicy">
  <wsp:ExactlyOne>
   <wsp:All/>
  </wsp:ExactlyOne>
 </wsp:Policy>
</wsdl:definitions>

Open in new window

Thanks for attaching the WSDL.
When you run the Java client in debug mode and watch the variable "res", what do you see after executing the line:
dummy.ActResponse res = service1.getAct(null);

Open in new window

"res" is instantiated
but the "res.getAct()" return null
ASKER CERTIFIED SOLUTION
Avatar of regevha
regevha

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Here is the print screen

netbeans.png
I added

-Dcom.sun.xml.ws.transport.http.client.HttpTransportPipe.dump=true

as VM option and can see the returned envelop and the contained data
still the object is null

what can that be I'm getting crazy
The printscreen is unreadable, please attach another one with better resolution
Is is perfectly readable if you just click on it :-)


Additionally the print screen will just confirm what I'm saying
I wonder what information you will get from a print screen :-)
I have lost patience