Hot questions for Using GlassFish in soap

Question:

In my desktop application i have a reference to a SOAP web service. The service is deployed on Glassfish server 3.0 and is mainly used to send byte arrays to client that form a pdf file. The service method sends 1 file at a time.

However, the problem is that some of the files never get transferred to the client unless the client machine pauses Kaspersky protection. I have tried adding my application to kaspersky's trusted applications but it doesn't help.

Has anyone had similar issues? Help would be appreciated.


Answer:

You can configure exclusions in Kaspersky Anti-Virus. You can follow below steps: 1) click Settings. 2) In the Settings window, go to the Protection Center section and select Web Anti-Virus. 3) In the Web Anti-Virus settings window, click Advanced Settings. 4) In the window Advanced settings of Web Anti-Virus, you can modify the following parameters: Configure Kaspersky URL Advisor --> On all websites except those specified

Here configure the URL of WSDL of your soap service.

But this approach you can use only for your machine ;-) Quoted from Link.

Question:

I have a jax-ws web service class with a web operation written as:

public String processIncomingMsg(int msgType, String senderCB, int receiveCB,
                int ussdOpType, String msIsdn, String serviceCode,
                int codeScheme, String ussdString,
                NamedParameterList extenionInfo) {

the service is deployed in the glassfish webserver so I have access to http://localhost:8080/AppName/ReceiveUSSDNotifications?Tester which is a form that is used to invoke the web service operation. When I enter receiveCB, one of the method parameters, as 0XFFFFFF. I see "Cannot convert 0xFFFFFFFF in int" in the glassfish server logs and

WS00041: Service invocation threw an exception with message : null; Refer to the server log for more details
Exceptions details : java.lang.IllegalArgumentException
javax.servlet.ServletException: java.lang.IllegalArgumentException at org.glassfish.webservices.monitoring.WebServiceTesterServlet.doPost(WebServiceTesterServlet.java:342) 
at org.glassfish.webservices.monitoring.WebServiceTesterServlet.invoke(WebServiceTesterServlet.java:106) 
at org.glassfish.webservices.JAXWSServlet.doPost(JAXWSServlet.java:157) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) 
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682) 
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)  
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160) 
at ...

As the response (error log) from the browser. I wonder what could be going wrong because 0xffffff is just a hex representation of an integer and so there shouldn't be a conversion problem.


Answer:

You should post your full stacktrace here.

At face value, I would say your expectation is not realistic:

  1. What you've supplied, for all intents and purposes is a String and by your operation definition, it's supposed to be converted to an int. The only way this could possibly happen is using some variant of Integer.parseInt, specifically the variant that converts hex to decimal,Integer.parseInt(int, 16). Any other incarnation of that method will blow up with a NumberFormatException. How would the testing tool or JAXB know you're not providing a Base-10 format, to be using the right variant of parseInt? Not to mention the preceeding "0x" would make it nonconvertible anyway

  2. Even if it somehow got converted, you'll find that Integer.MAX_VALUE== 2147483647, which is less than FFFFFF==4294967295. Another NumberFormatException. What you should have there is a long

Question:

I'm having a problem where my C# client can't parse the data from my webservice in Glassfish.

I have a WSDL and XSD for my webservices as follows:

And I'm using the next C# client to test this webservice:

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using ServicioInterventoria;

public partial class _Default : System.Web.UI.Page 
{
    ServicioInterventoria.ServicioInterventoria proxy;

    protected void Page_Load(object sender, EventArgs e)
    {
        proxy = new ServicioInterventoria.ServicioInterventoria();

        ResultadoMensualIC[] res = proxy.ObtenerResultadosMensuales("Intv12", "2014-07-07T08:08:08");

        System.Diagnostics.Debug.WriteLine(res.Length);
        System.Diagnostics.Debug.WriteLine(res[0].FechaCorte);

    }
}

The problem is that when I execute this code, the res array has the amount of objects that should have, but each value of each object has the default value instead of the correct value. I used Fiddler to check the traffic and it receives the correct SOAP response with the correct data, but it seems that my C# client doesn't know how to parse the data.

I checked with a Java client, and I can get the correct data without any problems, and seems that my C# it's the only one giving problems with this.

Maybe there is a problem with the targetNamespace in the SOAP response, but I don't understand why works correctly in Java but in C# just puts default values.

Anyone have any idea what could be the problem?

If someone needs more information about it, let me know

Thanks beforehand


Answer:

I solved last week. The problem was that the SOAP response didn't put the namespace for each attribute, then, the C# client doesn't know how to match this (seems like a limitation of C#). And, the other problem was the order of the SOAP response, because, the C# client was expecting each object as was defined in the WSDL, but the response it's ordered alphabetically, in this way, the C# client, doesn't match correctly each attribute.

I did some modifications to the client. First, in each model, for each attribute I added the namespace, something like this:

@XmlElement(name = "IdInterventor", namespace = "http://ws.bigdatasolutions.co/")
public String getIdInterventor() {
    return IdInterventor;
}

With this, the SOAP response always puts the namespace for each attribute, which was neccesary for the C# client.

After that, at the beginning of each model class I add this tag, to define the order as defined in the WSDL and expected for the C# client.

@XmlRootElement(name = "AspectosFinancieros")
@XmlType(propOrder={"idInterventor", "numeroContrato", "ano", "valorContratoOperador", "fechaFirmaContrato",
                    "valorAdicion", "fechaProrrogaAdicion", "valorDesembolso", "fechaPagoDesembolso", 
                    "valorAnticipo", "fechaAnticipo", "valorUtilizacion", "numeroActaAprobacion",
                    "fechaUtilizacion", "valorRendimiento", "fechaRendimiento", "numeroComprobanteRendimiento",
                    "valorComision", "fechaComision", "valorGastosAdministrativos", "fechaGastosAdministrativos",
                    "nombreFiducia", "numeroContratoFiducia", "fechaContratoFiducia", "fechaProrrogaAdicionFiducia",
                    "marcaTiempo"})
public class AspectosFinancieros {

I checked the expected order in the auto generated class in the C# client.

I hope someone find this useful.

Question:

I'm making a SOAP service. The structure looks like this:

>             <Person>
>                 <contactID>122</contactID>
>                 <firstName>Jimmy</firstName>
>                 <middleName>T.</middleName>
>                 <suffix>Jr.</suffix>
>                 <emailAddress>jim@m.net</emailAddress>
>                 <birthDate>1969-09-01T00:00:00-07:00</birthDate>     
>             </Person>

If the birthdate is null, my service will omit that node giving a response like the folowing:

>             <Person>
>                 <contactID>122</contactID>
>                 <firstName>Jimmy</firstName>
>                 <middleName>T.</middleName>
>                 <suffix>Jr.</suffix>
>                 <emailAddress>jim@m.net</emailAddress> 
>             </Person>

I need something that states that is null like:

>             <Person>
>                 <contactID>122</contactID>
>                 <firstName>Jimmy</firstName>
>                 <middleName>T.</middleName>
>                 <suffix>Jr.</suffix>
>                 <emailAddress>jim@m.net</emailAddress>
>                 <birthDate>null</birthDate>     
>             </Person>

I'm using java and glassfish. is it possible to accomplish this? by the way, birthDate is a Date. Thank you


Answer:

I just had to annotate my variable in the Person class as follows:

public class Person {

    @XmlElement(nillable=true, required=true) //added this
    public Date birthDate;

}