cancel
Showing results for 
Search instead for 
Did you mean: 

Web Service throws Exception

Former Member
0 Kudos

Hi,

I am trying to get quantity to build from ShopOrderServiceInterface. The code is given below:

@WebMethod

public long findShopOrder() throws BusinessException{

ShopOrderServiceInterface sosi = Services.getService("com.sap.me.demand", "ShopOrderService");

FindShopOrderByItemRequest fsobir = new FindShopOrderByItemRequest("SO12");

FindShopOrderResponse soResponse = sosi.findShopOrderByItem(fsobir);

if(soResponse != null){

List<ShopOrderBasicConfiguration> list = soResponse.getShopOrderList();

ShopOrderBasicConfiguration sobc = list.get(1);

return sobc.getQuantityToBuild().longValue() ;

}

return 0;

}

The shop order S012 is already available with build quantity of 5. While trying to execute this service, I was getting result as zero. I searched the log file for any error. I got the following error:

#2.0 #2011 07 22 12:30:53:720#+00#Error#System.err#

#BC-ESI-WS-JAV#sap.com/tcesiespwsnavui#002564FA71C200330000000100000120#5084250000000004#sap.com/tcesiespwsnavui#System.err#Administrator#1##C677DDF8B45C11E09E690000004D945A#6e2e2a29b45e11e0bf500000004d945a#6e2e2a29b45e11e0bf500000004d945a#0#Thread[HTTP Worker [@17174249],5,Dedicated_Application_Thread]#Plain##

ERROR: 'Premature end of file.'#

Please help me to resolve the issue.

Thanks,

Joe

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Thanks for your reply.

Sorry for the mistake in the description. The actual shop order is SO12 and it is available in SAP ME with 3 quantity to build.

While execting the webservice through Netweaver test tool, I am getting a message of 'Operation "findShopOrder" executed successfully'. The result displayed is zero. I had 3 quantity to build.

After the execution, I verified the log file. It has the following errors.

#2.0 #2011 07 25 08:55:50:139#+00#Error#System.err#

#BC-ESI-WS-JAV#sap.com/tcesiespwsnavui#002564FA71C200EA00000001000016DC#5084250000000004#sap.com/tcesiespwsnavui#System.err#Administrator#22##CBCD9A7AB69911E0819C0000004D945A#80bfa597b69b11e0ac8e0000004d945a#80bfa597b69b11e0ac8e0000004d945a#0#Thread[HTTP Worker [@13944224],5,Dedicated_Application_Thread]#Plain##

[Fatal Error] :-1:-1: Premature end of file.

#

#2.0 #2011 07 25 08:55:50:139#+00#Error#System.err#

#BC-ESI-WS-JAV#sap.com/tcesiespwsnavui#002564FA71C200EA00000002000016DC#5084250000000004#sap.com/tcesiespwsnavui#System.err#Administrator#22##CBCD9A7AB69911E0819C0000004D945A#80bfa597b69b11e0ac8e0000004d945a#80bfa597b69b11e0ac8e0000004d945a#0#Thread[HTTP Worker [@13944224],5,Dedicated_Application_Thread]#Plain##

ERROR: 'Premature end of file.'#.

Thanks,

Joe

Former Member
0 Kudos

Hi Joe,

One more thing, the code below returns you the second element of the list, because list's indexes in java are zero-based.


...
ShopOrderBasicConfiguration sobc = list.get(1);
...

change to:


...
ShopOrderBasicConfiguration sobc = list.get(0);
...

Hope it helps

Ivan

Former Member
0 Kudos

Hey Joe,

Check the name of the shop order in the code because is contains "O" - "SO12", but in the description below the code the shop order name is with zero (0) - S012. Most likely you have S012 in the system but looking for SO12.

The error has nothing to do with your code - there is no exception is the code. The reason is that the method


sosi.findShopOrderByItem(fsobir);

returns null and the following conditional statement is false:


if(soResponse != null){
...
}

Good luck

Ivan

Edited by: Ivan Dulko on Jul 22, 2011 3:15 PM