You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Calvin Smith <ca...@hotmail.com> on 2003/06/05 19:48:08 UTC

PATCH: fix for null pointer in wsdl2java

I was getting a nullpointer when I run wsdl2java.
here is the fix:
class: org.apache.axis.wsdl.symbolTable.SymbolTable
method: addMIMETypes
old code:
                if (obj instanceof MIMEContent) {
                    MIMEContent content = (MIMEContent) obj;
                    TypeEntry typeEntry = findPart(op, content.getPart());
                    String dims = typeEntry.getDimensions();
                    if(dims.length() <=0 && typeEntry.getRefType() != null) 
{
                        Node node = typeEntry.getRefType().getNode();
                        if(getInnerCollectionComponentQName(node)!=null)
                            dims += "[]";
                    }
                    String type = content.getType();
                    if(type == null || type.length() == 0)
                        type = "text/plain";
                    bEntry.setMIMEInfo(op.getName(), content.getPart(), 
type, dims);
                }

new code:
                if (obj instanceof MIMEContent) {
                    MIMEContent content = (MIMEContent) obj;
                    TypeEntry typeEntry = findPart(op, content.getPart());
                    String type = content.getType();
                    if(type == null || type.length() == 0)
                        type = "text/plain";
                    String dims;
                    if (typeEntry != null)
                    {
                      dims = typeEntry.getDimensions();
                      if(dims.length() <=0 && typeEntry.getRefType() != 
null) {
                          Node node = typeEntry.getRefType().getNode();
                          if(getInnerCollectionComponentQName(node)!=null)
                              dims += "[]";
                      }
                    }
                    else
                      dims = "[]";
                    bEntry.setMIMEInfo(op.getName(), content.getPart(), 
type, dims);
                }


and here is the offending wsdl.  if this wsdl is wrong and axis was right 
before just let me know.
<?xml version="1.0" encoding="UTF-8"?>

<definitions name="EchoService"
  targetNamespace="http://echo.test/"
  xmlns:tns="http://echo.test/"
  xmlns="http://schemas.xmlsoap.org/wsdl/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/">

  <types/>

  <message name="doEchoRequest">
    <part name="name" type="xsd:string"/>
  </message>

  <message name="doEchoResponse">
    <part name="result" type="xsd:string"/>
  </message>

  <portType name="Echo">
    <operation name="doEcho" parameterOrder="name">
      <input message="tns:doEchoRequest"/>
      <output message="tns:doEchoResponse"/>
    </operation>
  </portType>

  <binding name="EchoBinding" type="tns:Echo">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" 
style="rpc" />
    <operation name="doEcho">
      <soap:operation soapAction="Echo"/>
      <input>
        <mime:multipartRelated>
          <mime:part>
            <soap:body use="encoded" namespace="http://echo.test/"
                       
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
          </mime:part>
          <mime:part>
            <mime:content part="attch" type="text/html"/>
          </mime:part>
        </mime:multipartRelated>
      </input>
      <output>
        <soap:body use="encoded" namespace="http://echo.test/"
              encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
      </output>
    </operation>
  </binding>

  <service name="EchoService">
    <port name="Echo" binding="tns:EchoBinding">
      <soap:address location="http://127.0.0.1:1234/"/>
    </port>
  </service>

</definitions>

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*.  
http://join.msn.com/?page=features/featuredemail