实际错误是name "return" in tag of LoginToPublicPortalResponse.Return_ conflicts with name "ResultVO" in *ResultsVO.XMLName。该代码是由gowsdl生成的,当我尝试调用一个方法时,它给出了冲突错误。
这是我的类(class):

type LoginToPublicPortalResponse struct {
        XMLName xml.Name `xml:"http://publicportal.rest.powerschool.pearson.com/xsd loginToPublicPortalResponse"`

        Return_ *ResultsVO `xml:"return,omitempty"`
}

type ResultsVO struct {
        XMLName xml.Name `xml:"http://vo.rest.powerschool.pearson.com/xsd ResultsVO"`

        *BaseResultsVO

        CourseRequestGroupsVOs []*CourseRequestGroupVO `xml:"courseRequestGroupsVOs,omitempty"`
        CourseRequestRulesVO   *CourseRequestRulesVO   `xml:"courseRequestRulesVO,omitempty"`
        StudentDataVOs         []*StudentDataVO        `xml:"studentDataVOs,omitempty"`
        UserSessionVO          *UserSessionVO          `xml:"userSessionVO,omitempty"`
}
这是返回的实际XML:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <ns:loginToPublicPortalResponse xmlns:ns="http://publicportal.rest.powerschool.pearson.com/xsd">
         <return xmlns:ax290="http://vo.rest.powerschool.pearson.com/xsd" xmlns:ax291="http://model.rest.powerschool.pearson.com/xsd" xmlns:ax293="http://util.java/xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ax290:ResultsVO">
            <courseRequestRulesVO xsi:nil="true" />
            <userSessionVO xsi:type="ax290:UserSessionVO">
               <locale xsi:nil="true" />
               <serverCurrentTime>2018-05-14T10:33:05.260Z</serverCurrentTime>
               <serverInfo xsi:type="ax291:ServerInfo">
                  <apiVersion>2.3.0</apiVersion>
                  <dayLightSavings>3600000</dayLightSavings>
                  <parentSAMLEndPoint />
                  <publicPortalDisabled>false</publicPortalDisabled>
                  <publicPortalDisabledMessage xsi:nil="true" />
                  <rawOffset>-18000000</rawOffset>
                  <serverTime>2018-05-14T10:33:05.261Z</serverTime>
                  <studentSAMLEndPoint />
                  <teacherSAMLEndPoint />
                  <timeZoneName>EDT</timeZoneName>
               </serverInfo>
               <serviceTicket>AAABY142UccKhfZkXiTvJ7x/Qa7mtUVb07hutu6fLO9zh1dQUQQKWbkID4uOY9/9dwqDKgYewKpe6YXiJp3xFcmU/UOLl4Cwox4i10Ak1LXKzfLSKUiiH3SscaA9hOsH</serviceTicket>
               <studentIDs>207032</studentIDs>
               <userId>207032</userId>
               <userType>2</userType>
            </userSessionVO>
         </return>
      </ns:loginToPublicPortalResponse>
   </soapenv:Body>
</soapenv:Envelope>
我需要将结果更改为ResultsVO吗?停止嵌入结果VO?

最佳答案

我不知道问题的根源,但是当您从LoginToPublicPortalResponse Return_中删除`xml:“return,omitempty”时,它应该可以工作。

10-08 14:16